Fork me on GitHub
上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 125 下一页

2012年4月16日

摘要: 转载:http://hi.baidu.com/delphi9527/blog/item/2f29650d1302f2306159f319.html在实际工作中有些程序不可避免的需要使用数学函数进行计算,比如地图程序的地理坐标到地图坐标的变换。Objective-C做为ANSI C的扩展,使用C标准库头文件<math.h>中定义的数学常量宏及数学函数来实现基本的数学计算操作,所以不必费神再在Cocoa Foundation中寻找相应的函数和类了。这里列出一些常用宏和数学函数,更详细的信息还是需要去查阅<math.h>头文件。数学常量:#define M_E 2.71828 阅读全文
posted @ 2012-04-16 10:18 pengyingh 阅读(2938) 评论(0) 推荐(0)
摘要: - (NSString *)stringByDecodingXMLEntities { NSUInteger myLength = [self length]; NSUInteger ampIndex = [self rangeOfString:@"&" options:NSLiteralSearch].location; // Short-circuit if there are no ampersands. if (ampIndex == NSNotFound) { return self; } // Make result string ... 阅读全文
posted @ 2012-04-16 09:59 pengyingh 阅读(1478) 评论(0) 推荐(1)
摘要: 将字符串按如下方式处理NSString *tempStr2=[tempStr stringByAddingPercentEscapesUsingEncoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000)]; 阅读全文
posted @ 2012-04-16 09:48 pengyingh 阅读(111) 评论(0) 推荐(0)
摘要: http://www.goodldy.com/2011/08/cocoa-color/最近频繁用到颜色,整理了以下几个函数用于NSColor,16进制,整形间的转换@interface NSColor(NSColorHexadecimalValue)-(NSString*)hexadecimalValueOfAnNSColor;-(unsigned int)hexadecimalINTValueOfAnNSColor;+(NSColor *)getColorFromhexStr:(NSString *)hexColor;@end @implementation NSColor(NSColorH 阅读全文
posted @ 2012-04-16 09:45 pengyingh 阅读(681) 评论(0) 推荐(0)

2012年4月15日

摘要: //查找某关键字在目标字符串中出现次数及位置- (NSMutableArray *)filterString{ NSString *str = @"abcdefg&123_我们haha,.123hf 123"; NSLog(@"%lu~~%i",strlen((char *)[str UTF8String]),[str length]); NSRange range={0,0}; NSMutableArray *arr = [[NSMutableArray alloc]initWithCapacity:0]; //每次指针偏移量 int loc 阅读全文
posted @ 2012-04-15 11:32 pengyingh 阅读(339) 评论(0) 推荐(0)
摘要: #define isRetina ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640,960), [[UIScreen mainScreen] currentMode].size) : NO)NSString*deviceType =[UIDevice currentDevice].model;if([deviceType isEqualToString:@"iPhone"]){ //iPhone}elseif([deviceType 阅读全文
posted @ 2012-04-15 07:04 pengyingh 阅读(635) 评论(0) 推荐(0)
摘要: 原文地址:NSScanner类参考作者:飞舞的鸡毛概述该NSScanner类是从一个抽象超类集群,它可以扫描值声明为对象的编程接口NSString对象。一个NSScanner对象解释并转换成一个字符NSString值的对象为数量和字符串。你指派它的扫描仪创建的字符串,并通过扫描仪的字符串的字符的进展,从开始到结束,你要求的项目。由于集群阶级性质,扫描仪的对象不是实际情况的NSScanner子一类,但其私人。虽然扫描仪对象的类是私有的,它的接口是公共的,因为,这种抽象宣布超NSScanner。原始的方法对NSScanner是string,根据上市的所有方法“配置扫描器”“一节中的方法”的任务。您 阅读全文
posted @ 2012-04-15 07:00 pengyingh 阅读(410) 评论(0) 推荐(1)

2012年4月14日

摘要: 转自:http://blog.csdn.net/w59879213/article/details/7162769开发心得.首先是获取网络中的图片, 将图片从网络中以NSData的形式读取到本地的代码很简单, 只有两句话就可以了.NSString*url=@"http://www.163.com/a.jpg";NSData*imageData=[[NSDataalloc]initWithContentsOfURL:[NSURLURLWithString:url]];其次是将图片保存到sqlite中, 在查询中绑定BLOB类型即可sqlite3_bind_blob(stmt, 阅读全文
posted @ 2012-04-14 09:46 pengyingh 阅读(2678) 评论(0) 推荐(0)
摘要: BlockApple 在C, Objective-C, C++加上Block這個延申用法。目前只有Mac 10.6 和iOS 4有支援。Block是由一堆可執行的程式組成,也可以稱做沒有名字的Function (Anonymous function)。如果是Mac 10.6 或 iOS 4.0 之前的平台可以利用 http://code.google.com/p/plblocks/ 這個project得以支援Block語法。Apple有一個叫做GCD(Grand Central Dispach)的新功能,用在同步處理(concurrency)的環境下有更好的效率。Block語法產生的動機就是來 阅读全文
posted @ 2012-04-14 09:41 pengyingh 阅读(190) 评论(0) 推荐(0)
摘要: http://blog.csdn.net/workhardupc100/article/details/7443580UIWebView*webView = [[[UIWebViewalloc]initWithFrame:CGRectMake(0,0,320,480)]autorelease];NSString*htmlPath = [[[NSBundlemainBundle]bundlePath]stringByAppendingPathComponent:@"Quartz2D.html"];htmlPath = [htmlPathstringByAddingPercen 阅读全文
posted @ 2012-04-14 09:38 pengyingh 阅读(305) 评论(0) 推荐(0)
上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 125 下一页

导航