随笔分类 - iOS
摘要:原文地址:http://blog.csdn.net/xunyn/article/details/13629071一.UDID(Unique Device Identifier)UDID是Unique Device Identifier的缩写,中文意思是设备唯一标识.在很多需要限制一台设备一个账号的应用中经常会用到,在Symbian时代,我们是使用IMEI作为设备的唯一标识的,可惜的是Apple官方不允许开发者获得设备的IMEI.ios5 sdk中的获取方法:[UIDevice currentDevice] uniqueIdentifier] uniqueIdentifier在UIDevice.
阅读全文
摘要:原文地址:http://blog.sina.com.cn/s/blog_91ff71c0010188u9.html1.NSDateFormatter配合NSDate与NSString之间的转化NSDateFormatter有下面2个方法: - (NSString *)stringFromDate:(NSDate *)date;//NSDate转NSString - (NSDate *)dateFromString:(NSString *)string;//NSString转NSDatee.g.NSString *dateString=@"1900-01-01"; NSDat
阅读全文
摘要:原文地址:http://blog.csdn.net/pjk1129/article/details/6855024#import @interface NSString (md5)-(NSString *) md5HexDigest;@end#import "NSString+MD5HexDigest.h"@implementation NSString (md5) -(NSString *) md5HexDigest{ const char *original_str = [self UTF8String]; unsigned char result[CC_MD5_DIG
阅读全文
摘要:原文地址:http://blog.sina.com.cn/s/blog_71715bf801016d2y.htmlgdb不是万能的,可是没有gdb却是万万不能的。这里给大家简单介绍下iOS开发中最基本的gdb命令。popo是print-object的简写,可用来打印所有NSObject对象。使用举例如下:(gdb) po self(gdb) po [self view]>(gdb) print-object [self view]>pp是print的简写,可以用来打印所有的简单类型,如int, float,结构体等。使用举例如下:(gdb) p self$1 = (Launcher
阅读全文
摘要:What’s NewAutomatic Dimensions- (CGFloat)tableView:(UITableView *)tableViewheightForHeaderInSection:(NSInteger)sectionCGFloat UITableViewAutomaticDimensionAutomatic Animation StyleUITableViewRowAnimationAutomaticNew Update Methods- (void)moveSection:(NSInteger)section toSection:(NSIntege...
阅读全文
摘要:TextDynamic TypeSpecifies fonts semanticallySupports user text sizingOptimized for legibilitySupports accessibility sizes and enhancementsText StylesHeadline 1UIFontTextStyleHeadline1Headline 2UIFontTextStyleHeadline2Subheadline 1UIFontTextStyleSubheadline1Subheadline 2UIFontTextStyleSubheadline2Bod
阅读全文
摘要:原文地址:http://www.rockia.net/2013/03/fix-xcode-update-pch-file-error有不少朋友反应,升级Xcode到最新的4.6.1版本之后,会有下面的错误:Error:PCH file built from a different branch ((clang-425.0.24)) than the compiler ((clang-425.0.27))其实这只是一个不同Xcode版本之间的一点小冲突,解决方法非常容易,如下:选择Xcode菜单的Products(产品)按住键盘的Option按键,然后选择图示的Clean Build Folde
阅读全文
摘要:原文地址:http://blog.csdn.net/frankwun/article/details/7688950准备:字体文件(.ttf,.odf)方法1: 添加对应的字体(.ttf或.odf)到工程的resurce,使用cocos2d中的FontLabel库,FontLabel继承于UILabel,象UILabel一样使用就好了 fontName直接使用添加的资源名字即可方法2: 1.添加对应的字体(.ttf或.odf)到工程的resurce,例如my.ttf 2.在info.plist中添加一项 Fonts provided by application (item0对应的va...
阅读全文
摘要:原文地址:http://iostrack.com/post/2012-06-28/40027722656ARC是编译器LLVM 3.0的新功能,而非iOS,因此ARC支持 Mac OS X v10.6 v10.7 (64-bit applicati*****) 以及 iOS 4 iOS 5. (遗憾的是,weak reference 是runtime属性,因此 不支持 iOS 4 和 Mac OS X v10.6。)如果需要手动释放内存,在该释放的地方添加 = nil 来替代原本的releaseARC只对objective-c对象起作用,对于Core Foundation 之类,你仍然需要自己
阅读全文
摘要:1、调用电话[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:10086"]];2.调用短信[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:10086"]];3.调用邮箱[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto:10086@qq.com"]];4.程序B
阅读全文
摘要:1 //NSData转换为UIImage2 NSData *imageData = [NSData dataWithContentsOfFile: imagePath];3 UIImage *image = [UIImage imageWithData: imageData];4 5 //UIImage转换为NSData6 NSData *imageData = UIImagePNGRepresentation(aimae);
阅读全文
摘要:原帖地址:http://blog.sina.com.cn/s/blog_6cffce7701016k7p.htmlNSAttributedString可以让我们使一个字符串显示的多样化,但是目前到iOS 5为止,好像对它支持的不是很好,因为显示起来不太方便(至少没有在OS X上方便)。首先导入CoreText.framework,并在需要使用的文件中导入:#import<CoreText/CoreText.h>创建一个NSMutableAttributedString:1 NSMutableAttributedString *attriString = [[[NSMutableAt
阅读全文
摘要:获得IOS系统版本号1 [[[UIDevice currentDevice] systemVersion] floatValue]获得硬件名称 1 + (NSString*)getMachine{ 2 size_t size; 3 sysctlbyname("hw.machine", NULL, &size, NULL, 0); 4 char *name = malloc(size); 5 sysctlbyname("hw.machine", name, &size, NULL, 0); 6 7 NSString *machine = [
阅读全文
摘要:原帖地址:http://www.cnblogs.com/chivas/archive/2012/06/08/2541807.html最普通动画:1 //开始动画 2 [UIView beginAnimations:nil context:nil]; 3 //设定动画持续时间 4 [UIView setAnimationDuration:2]; 5 //动画的内容 6 frame.origin.x += 150; 7 [img setFrame:frame]; 8 //动画结束 9 [UIView commitAnimations]; 连续动画:一个接一个地显示一系列的图像 1 NSArray.
阅读全文
摘要:原帖地址:http://blog.csdn.net/xunyn/article/details/7882087IOS项目中会用到对通讯录的联系人或是会员按姓名为关键字排序,因为NSArray并不直接支持对汉字的排序,这就要通过将汉字转换成拼音完成按A~Z的排序,这看起来是个头疼的问题,因为牵扯到汉字转为拼音,kmyhy给出一个较易实现的方法,获取汉字的首字的首字母,如将“王”变成“W”,完整文章(传送门)。其中他通过pinyinFirstLetter函数获取中文拼音,函数原理是:“pinyinFirstLetter基于这么一个简单的原理:我们知道,在Objective C语言中,字符串是以un
阅读全文
摘要:-(NSURL*)applicationDocumentsDirectory{ return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];}-(NSString*)applicationDocumentsDirectoryPath{ return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) l...
阅读全文
摘要:原帖地址:http://www.raywenderlich.com/980/core-data-tutorial-how-to-preloadimport-existing-dataThis is the second part of a three-part series to help get you up to speed with the basics of Core Data quickly.In thefirst part of the series, we created a visual data model for our objects, ran a quick and d
阅读全文
摘要:UIView存在nib时,不能使用alloc init,正确的方法如下:1 NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomView" owner:self options:nil];2 UIView *tmpCustomView = [nib objectAtIndex:0];其中对应的nib文件应设置file owner。这样就可以使用nib中的UIView了。
阅读全文

浙公网安备 33010602011771号