随笔分类 -  Object—C

摘要:主要代码: 1 先设置一个定时器 2 TimeInterval:设置时间间隔 3 target:表示发送的对象 4 selector:选择一个实例方法 5 userInfo:此参数可以为nil,当定时器失效时,由你指定的对象保留和释放该定时器 6 7 [NSTimer scheduledTimer... 阅读全文
posted @ 2015-07-20 21:32 凝月霜雪 阅读(526) 评论(0) 推荐(0)
摘要:KVC(KeyValueCoding) “键-值-编码”是一种可以直接通过字符串的名字(key)来访问类实例变量的机制。KVC可以用来访问和设置实例变量的值。设置方式:[self setValue:aName forKey:@"name"] [self setValue:aName forK... 阅读全文
posted @ 2015-07-20 20:08 凝月霜雪 阅读(201) 评论(0) 推荐(0)
摘要:如果学生没有来上课,老师给家长发送通知 1 #import "Parents.h" 2 // #import "Teacher.h" 3 @implementation Parents 4 5 - (instancetype)init 6 { 7 self = [super init]... 阅读全文
posted @ 2015-07-20 19:29 凝月霜雪 阅读(507) 评论(0) 推荐(0)
摘要:1 int main(int argc, const char * argv[]) { 2 @autoreleasepool { 3 4 5 //复制文件 6 7 8 //找到原来的文件... 阅读全文
posted @ 2015-07-15 21:46 凝月霜雪 阅读(187) 评论(0) 推荐(0)
摘要:1》stuID一样时添加失败2》根据stuID修改联系人姓名、手机号3》根据姓名删除联系人 1 int main(int argc, const char * argv[]) { 2 @autoreleasepool { 3 4 ManagerPhone *... 阅读全文
posted @ 2015-07-15 15:29 凝月霜雪 阅读(143) 评论(0) 推荐(0)
摘要:1 NSString *filePath = @"/Users/scjy/hello/iphone.txt"; 2 3 NSFileHandle *handle=[NSFileHandle fileHandleForUpdatingAtPath:filePath]... 阅读全文
posted @ 2015-07-14 12:25 凝月霜雪 阅读(427) 评论(0) 推荐(0)
摘要:1 //创建NSDate实例,返回GMT时间 2 NSDate *date1=[NSDate date]; 3 NSLog(@"%@",date1); 4 5 //返回date1保存的时间与date2的时间间隔 6 ... 阅读全文
posted @ 2015-07-14 10:04 凝月霜雪 阅读(181) 评论(0) 推荐(0)
摘要:1 /**************** NSDictionary *****************/ 2 3 //创建一个新的字典 4 NSDictionary *dictionary1=[NSDictionary dictionary]; 5 ... 阅读全文
posted @ 2015-07-14 10:02 凝月霜雪 阅读(156) 评论(0) 推荐(0)
摘要:1 //字符串的创建 2 NSString *s1 = @"Rose"; 3 4 // 作用相当于s1,基本不用 5 // 警告:Using 'initWithString:' with a literal is redundant 6 // 用“... 阅读全文
posted @ 2015-07-10 19:40 凝月霜雪 阅读(512) 评论(0) 推荐(0)