`

Objective-C的消息、类定义、属性、编译器指令、类别和协议

 
阅读更多
Objective-C使用许多典型的面向对象编程元素,但其语法有些独特 
面向对象的元素  语  法 
对象消息 [recipient message];
类创建  /* .h file */  @interface class: super       (declarations) @end
/* .m file */
@implementation class   
  (definitions)
@end  (续)
面向对象的元素  语  法
  方法声明 - (return type)instancemethod:arguments
+ (return type)classmethod:arguments
属性声明 @property (declaration) variable;
属性综合 @synthesize property;
属性获取方法 [object property];
属性设置方法 [object setProperty:value];
属性点语法 object.property 
类别声明 @interface class: super (category)  @implementation class: super (category) 协议声明
@interface class: super <protocol>


大部分的编程工作是使用UIKit(UI)或Foundation(NS)框架完成的。这些库共同称作Cocoa Touch。它们建立在苹果公司的现代Cocoa框架上
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics