上一页 1 2 3 4 5 6 7 ··· 29 下一页

2017年5月24日

OC 成员变量 ( -> 使用 )

摘要: @interface Student : NSObject { // @public // @protected // @private // 默认的作用域是@protected int age; @protected int no; @public float height; } @propert... 阅读全文

posted @ 2017-05-24 17:13 守望星空 阅读(161) 评论(0) 推荐(0) 编辑

OC @protocol(声明协议 )

摘要: 调用 阅读全文

posted @ 2017-05-24 17:10 守望星空 阅读(222) 评论(0) 推荐(0) 编辑

OC property(声明)

摘要: // 在xcode4.5的环境下,可以省略@synthesize,并且默认会去访问_age这个成员变量// 如果找不到_age这个成员变量,会自动生成一个叫做_age的私有成员变量 阅读全文

posted @ 2017-05-24 17:07 守望星空 阅读(129) 评论(0) 推荐(0) 编辑

OC category(分类)

摘要: // ()代表着是一个分类 // ()中的Test代表着分类的名称 @interface Student (Test) // 分类只能扩展方法,不能增加成员变量 - (void)test2; @end 阅读全文

posted @ 2017-05-24 17:03 守望星空 阅读(96) 评论(0) 推荐(0) 编辑

OC block声明和使用

摘要: 补充: 阅读全文

posted @ 2017-05-24 17:02 守望星空 阅读(347) 评论(0) 推荐(0) 编辑

OC 内存管理(retain和release)

摘要: 内存管理 retain和release简单使用 #import <Foundation/Foundation.h> #import "Student.h" void test() { Student *stu = [[Student alloc] init]; // 1 // z代表无符号 NSLo 阅读全文

posted @ 2017-05-24 16:50 守望星空 阅读(345) 评论(0) 推荐(0) 编辑

OC @class关键字

摘要: // 如果是继承某个类,就要导入类的头文件// 如果只是定义成员变量、属性,用@class 阅读全文

posted @ 2017-05-24 16:47 守望星空 阅读(154) 评论(0) 推荐(0) 编辑

OC typedef(起别名)

摘要: // #define Integer int // 给基本数据类型起别名 void test() { typedef int Integer; typedef Integer MyInteger; typedef unsigned int UInteger; int a = 10; Integer b = 9; ... 阅读全文

posted @ 2017-05-24 16:44 守望星空 阅读(1002) 评论(0) 推荐(0) 编辑

OC static 和函数

摘要: #include // 定义一个one函数 // 完整地定义一个外部函数需要extern关键字 //extern void one() { // printf("调用了one函数\n"); //} // 内部函数,需要用static关键字修饰,说明不能在其他文件中访问 static void one() { printf("调用了one函数\n"); } #ifnde... 阅读全文

posted @ 2017-05-24 16:42 守望星空 阅读(206) 评论(0) 推荐(0) 编辑

OC static 和变量

摘要: 调用: 阅读全文

posted @ 2017-05-24 16:40 守望星空 阅读(146) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 29 下一页

导航