上一页 1 ··· 60 61 62 63 64 65 66 67 68 ··· 167 下一页
摘要: // // main.m // NSArray是不可变的,一旦初始化完毕,就不能添加和删除了。类似于NSString和NSMutilString。 #import #import "Person.h" int main(int argc, const char * argv[]) { NSArray *arr1 = [[NSArray alloc] init]; //NSAr... 阅读全文
posted @ 2017-08-27 15:39 无天666 阅读(234) 评论(0) 推荐(0)
摘要: // main.m // NSMutableString基本概念,NSString是不可变字符串,NSMutableString是可变字符串。NSMutableString继承NSString,所以NSString得所有方法NSMutableString都是可以用的。 #import int main(int argc, const char * argv[]) { ... 阅读全文
posted @ 2017-08-27 15:04 无天666 阅读(603) 评论(0) 推荐(0)
摘要: // // main.m // 字符串截取 #import int main(int argc, const char * argv[]) { NSString *str = @"小码哥"; /* // NSRange : 位置/长度 // NSRange range = {6, 3}; // NSRange range; // range.... 阅读全文
posted @ 2017-08-27 14:45 无天666 阅读(463) 评论(0) 推荐(0)
摘要: // // main.m // NSString基本概念 // Foundation框架,苹果有80多个框架,Foundation有125个头文件。 #import int main(int argc, const char * argv[]) { //如何创建字符串对象 /* 通过不同的方式创建字符串,字符串对象储存的位置也不一样 >如果是通过... 阅读全文
posted @ 2017-08-27 14:15 无天666 阅读(1499) 评论(0) 推荐(0)
摘要: // // BabyProtocol.h #import @class Baby; @protocol BabyProtocol // 喂婴儿吃东西 - (void)feedFood:(Baby *)baby; // 哄婴儿睡觉 - (void)hongBaby:(Baby *)baby; @end // // Baby.h // day17 #import #impor... 阅读全文
posted @ 2017-08-27 01:28 无天666 阅读(290) 评论(0) 推荐(0)
摘要: // WifeCondition.h #import @protocol WifeCondition // 会做饭 - (void)cooking; // 会洗衣服 - (void)washing; // 有一份好工作 - (void)job; @end // Person.h #import #import "Wife.h" @interface Person : NSO... 阅读全文
posted @ 2017-08-27 01:07 无天666 阅读(339) 评论(0) 推荐(0)
摘要: // // SportProtocol.h // day17 // #import @protocol SportProtocol //NSObject是默认的协议类,每个协议都要继承NSObject基协议。不写也可以。 // 1.协议只能声明方法, 不能声明属性(跟分类一样) //{ // int _age; //} // 方法声明列表 // 2.注意: 如果没有使用... 阅读全文
posted @ 2017-08-27 00:47 无天666 阅读(258) 评论(0) 推荐(0)
摘要: // // SportProtocol.h // day17 #import @protocol SportProtocol // 方法声明列表 - (void)playFootball; - (void)playBasketball; - (void)playBaseball; @end // // Person.h // day17 #import #import "S... 阅读全文
posted @ 2017-08-27 00:42 无天666 阅读(368) 评论(0) 推荐(0)
摘要: // // main.m // Block的应用场景 // typedef void (^workBlock)(); #import /* void goToWorkPrefix() { NSLog(@"起床"); NSLog(@"穿衣服"); NSLog(@"洗漱"); NSLog(@"喝早茶"); NSLog(@"驾车去上班"); } void goToWork... 阅读全文
posted @ 2017-08-26 21:05 无天666 阅读(260) 评论(0) 推荐(0)
摘要: // // main.m // Block基本使用:一种数据类型,应用在动画,多线程,集合遍历,网络请求回调。 // 用来保存一段代码,在恰当的时候拿出来调用。功能类似于函数。函数不能嵌套定义,block可以, // 函数指针和block是一样的,相当于代码指针。 #import void printRose(int num) { for (int i = 0; i ... 阅读全文
posted @ 2017-08-26 21:04 无天666 阅读(236) 评论(0) 推荐(0)
上一页 1 ··· 60 61 62 63 64 65 66 67 68 ··· 167 下一页