Category / Extensions / Protocol /Informal Protocol
来源:互联网 发布:软件评测师难考吗 编辑:程序博客网 时间:2024/06/02 05:36
nil a null object pointer (id)0
Nil a null class pointer (Class)0
NO a boolean false value (BOOL)0
YES a boolena true value (BOOL)1
1. Category
1.1 the declaration of a category interface looks very much like a class interface declarartion
//"ClassName+CategoryName.h"
#import "ClassName.h"
@interface ClassName (CategoryName)
//method declaration
@end
--------------------------------
//"ClassName+CategoryName.m"
#import "ClassName+CategoryName.h"
@implementation ClassName (CategoryName)
//method definitions
@end
2. Extensions
2.1 extensions is just like inhrite
3. Protocal
3.1 protocol use for declaring interface for others to implement
3.2 delcaring a protocol (Formal protocols)
@protocol MyXMLSupport
//method declarations
-(NSXIMLElemtn *)XMLRepresentation;
-initFromXMLRepresentation:(NSXMLElement *)XMLElement;
@end
----------------------------------
@protocol MyXMLSupport
@optional
-(void)showText;
@required
//...
@end
3.4 informal protocols
informal protocols are typically declared as categories of the NSObject class.
@interface NSObject (MyXMLSupport)
//method declaretion
@end
3.5 use the protocols
@interface ClassName:ItsSuperClass <protocol list>
@end
- Category / Extensions / Protocol /Informal Protocol
- Category vs Protocol
- Mac/iPhone Category & Protocol
- Category Protocol 使用场合
- Category Protocol 使用场合
- 继承,Protocol,Category
- Category、Extension、Protocol
- Category Extension protocol 总结
- category、block、protocol、SEL
- 分类(category)、协议(protocol)
- 8、category、extension、protocol
- Category protocol delegate
- [TwistedFate]category Extensxion protocol
- Category、Protocol、Extension
- Category和protocol区别
- Objective-C(八、正式协议Protocol,非正式协议informal protocol)——iOS开发基础
- object-c category 和 protocol
- Category和protocol的区别
- linux启动时,忘记密码如何修改?
- android 获取设备的IP和Mac地址
- BOX2D 自然的旋转到一个指定角度
- coding - 求连续子数组的最大和
- BOX2D 自然的移动到一个指定速度
- Category / Extensions / Protocol /Informal Protocol
- 主定理、static、指针
- JNDI介绍(详解,什么是JNDI)
- C++输入cin详解
- TreeSet,Comparator集合应用
- LoaderQueue:带优先级的加载队列
- 数据库三大范式详解
- C语言之常见问题解惑
- GridLayout网格布局