摘要: NSString *str = @"hello"; //字体 UIFont *font = [UIFont systemFontOfSize:16.0]; //文本风格,设置居中 NSMutableParagraphStyle ... 阅读全文
posted @ 2015-07-01 20:29 aY_Wonder 阅读(799) 评论(0) 推荐(0) 编辑
摘要: NSInteger max = [[self.array valueForKeyPath:@"@max.intValue"] integerValue];NSInteger min = [[self.array valueForKeyPath:@"@min.intValue"] integerVal... 阅读全文
posted @ 2015-07-01 20:08 aY_Wonder 阅读(195) 评论(0) 推荐(0) 编辑
摘要: UITabBarController *barController = [[UITabBarController alloc] init];//为barController添加四个viewControllerbarController.viewControllers = @[first,second... 阅读全文
posted @ 2015-07-01 11:52 aY_Wonder 阅读(3302) 评论(0) 推荐(0) 编辑
摘要: 将图片存放在Images.xcassetsImages.xcassets 存放到其中的资源图片不能通过地址访问(contentsOfFile),只能通过(imageNamed)访问.因为Images.xcassets为每张图片创建了一个文件夹进行存放.将图片直接拖入项目中Copy items if ... 阅读全文
posted @ 2015-06-24 09:18 aY_Wonder 阅读(284) 评论(0) 推荐(0) 编辑
摘要: 系统定义的常用结构体NSRangeNSPoint (CGPoint)NSSize (CGSize)NSRect (CGRect)常用的结构体方法初始化NSMakeRangeCGPointMakeCGSizeMakeCGRectMake打印结构体,返回字符串- (NSString *) NSStrin... 阅读全文
posted @ 2015-06-17 09:39 aY_Wonder 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 协议(@protocol):相当于java的接口协议的方法不一定要实现,可以使用@required和@optional来设置,默认为@required(ob为弱语法,即使不实现必选方法编译运行也不会报错)Class的反射常用方法Class 变量名 = [类或者对象 class];Class 变量名 ... 阅读全文
posted @ 2015-06-16 09:33 aY_Wonder 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 相同点:都可以作为方法的返回类型不同点:instancetype可以返回和方法所在类相同类型的对象,id只能返回未知类型的对象instancetype只能作为返回值,不能像id那样作为方法的参数好处:能够确定对象的类型,能够帮助编译器更好的为我们定位代码书写问题[[[NSArray alloc] i... 阅读全文
posted @ 2015-06-15 09:16 aY_Wonder 阅读(85) 评论(0) 推荐(0) 编辑
摘要: readwrite / readonly 读写和只读assign / copy / retainassign: 直接赋值,适合一些基本数据类型copy: 内容拷贝,建立一个相同的对象retain: 指针拷贝,保存其对象,并且计数值+1 阅读全文
posted @ 2015-06-15 09:00 aY_Wonder 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 块(block)的用法 //无参无返回值 void (^message)(void) = ^{ NSLog(@"Hello World!\n"); }; //有参有返回值 NSString *... 阅读全文
posted @ 2015-06-09 20:21 aY_Wonder 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 系统类型对象归档:已经实现了NSCoding协议,支持归档写入-writeToFile:atomically;读取-dictionaryWithContentsOfFile;-arrayWithContentsOfFile;-dataWithContentsOfFile;-stringWithCon... 阅读全文
posted @ 2015-06-09 16:06 aY_Wonder 阅读(246) 评论(0) 推荐(0) 编辑