摘要:
阅读全文
posted @ 2015-08-22 22:13
facial
阅读(252)
评论(0)
推荐(0)
摘要:
避免函数名和字段重复:代码: 阅读全文
posted @ 2015-08-22 22:10
facial
阅读(150)
评论(0)
推荐(0)
摘要:
第一种是经典方式, 第一种是点语法. 阅读全文
posted @ 2015-08-22 22:05
facial
阅读(193)
评论(0)
推荐(0)
摘要:
- 是实例方法,是用实例对象进行调用的;+ 是类方法,又称静态方法,是用类来调用的;@interface Person: NSObject { int _age;}- (void) setAge: (int)Age;- (int) getAge;- (int) setNewAge: (int) n... 阅读全文
posted @ 2015-08-22 21:58
facial
阅读(296)
评论(0)
推荐(0)
摘要:
-(int) f:(int)x;1.这里 - 表示对象方法, +表示类的方法2.参数分割使用 : 号来分开多参数情况:1.函数不带参数 (函数名: f) -(int) f2.带一个参数(函数名 f:x) -(int) f:(int)x 类似c语言中的 int f(int x) 函数3.带两个... 阅读全文
posted @ 2015-08-22 18:17
facial
阅读(3763)
评论(0)
推荐(1)
摘要:
@interface Dog: NSObject { @public int age; @protected int ID; @Private float price; }@end字段作用域解析:public: 对象该字段是全局,均可访问protected: 对象该字段是保... 阅读全文
posted @ 2015-08-22 14:52
facial
阅读(256)
评论(0)
推荐(0)
摘要:
创建/销毁 对象:Dog *dog = [Dog alloc]; // 通过alloc创建dog一个这样的对象, alloc相对于C语言中的new // *号既表示指针,也表示引用初始化构造函数:[dog init];销毁对象:[dog release] 阅读全文
posted @ 2015-08-22 14:43
facial
阅读(599)
评论(0)
推荐(0)
摘要:
OC类分为两个文件,一个是.h文件,一个是.m文件 .h文件 存放类,函数的申明 .文件 存放类的具体实现类申明使用关键字 @interface @end来申明类实现使用关键字@implementation @end来实现类声明:#import //相当于c语言的include@interfa... 阅读全文
posted @ 2015-08-22 14:35
facial
阅读(520)
评论(0)
推荐(0)

浙公网安备 33010602011771号