摘要: 原文: https://developer.apple.com/library/ios/documentation/General/Conceptual/DevPedia-CocoaCore/Selector.html#//apple_ref/doc/uid/TP40008195-CH48-SW1 阅读全文
posted @ 2016-07-30 13:24 EricSun 阅读(143) 评论(0) 推荐(0) 编辑
摘要: _weak typeof(self) weakSelf = self; (一)内存管理原则 1、默认strong,可选weak。strong下不管成员变量还是property,每次使用指针指向一个对象,等于自动调用retain(), 并对旧对象调用release(),所以设为nil等于release 阅读全文
posted @ 2016-04-14 23:05 EricSun 阅读(163) 评论(0) 推荐(0) 编辑
摘要: BOLCK和函数的相似性:(1)可以保存代码(2)有返回值(3)有形参(4)调用方式一样。 有参数的block 用typedef简化定义block的方式 阅读全文
posted @ 2016-04-14 00:11 EricSun 阅读(175) 评论(0) 推荐(0) 编辑
摘要: NSSearchPathForDirectoriesInDomains函数详解 #import "NSString+FilePath.h" @implementation NSString (FilePath) //检索指定路径 //第一个参数指定了搜索的路径名称,NSDocumentDirecto 阅读全文
posted @ 2016-04-12 13:06 EricSun 阅读(329) 评论(0) 推荐(0) 编辑
摘要: 一.类别(Category) 类别(Category)是一种可以为现有的类(包括类簇:NSString...,甚至源码无法获得的类)添加新方法的方式无需从现有的类继承子类。类别添加的新方法可以被子类继承。 注:继承(inheritance)无法为一个类簇创建子类。类别不能添加实例变量。 1. 创建类 阅读全文
posted @ 2016-04-05 21:32 EricSun 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 1.新建一个xib文件描述一个view的内部结构(假设叫做SSTgCell.xib) 2.新建一个自定义的类 (自定义类需要继承自系统自带的view, 继承自哪个类, 取决于xib根对象的Class) 3.新建类的类名最好跟xib的文件名保持一致(比如类名就叫做SSTgCell) 4.将 xib中的 阅读全文
posted @ 2016-04-05 21:26 EricSun 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 1.新建一个继承自UITableViewCell的类 2.重写initWithStyle:reuseIdentifier:方法 (先要调用父控件的nitWithStyle:reuseIdentifier:方法) 添加所有需要显示的子控件(不需要设置子控件的数据和frame, 子控件要添加到conte 阅读全文
posted @ 2016-04-05 19:58 EricSun 阅读(160) 评论(0) 推荐(0) 编辑
摘要: // 创建弹框 从底部弹出,一般用于危险操作 UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"恭喜通关" delegate:nil cancelButtonTitle:@"取消" destructiveButtonTitle 阅读全文
posted @ 2016-04-03 18:23 EricSun 阅读(173) 评论(0) 推荐(0) 编辑
摘要: // if((btn.currentTitle == answerBtn.currentTitle) && btn.hidden == YES) // 字符串相等比较 不要直接比,这样比的是指针,不是指针指向的数据 if([btn.currentTitle isEqualToString:answe 阅读全文
posted @ 2016-04-01 11:52 EricSun 阅读(1234) 评论(0) 推荐(0) 编辑
摘要: 控件就是指UIView 阅读全文
posted @ 2016-03-28 23:26 EricSun 阅读(149) 评论(0) 推荐(0) 编辑