2013年4月15日

关联引用(Associative References)-------为现有类添加变量

摘要: 能够模拟添加一个实例变量到一个已有的类中,能够添加存储到一个对象中而不需要改变类的定义。1.通过分类给已有类添加属性1 @interface Person:NSObject2 @end3 4 @implementation Person5 @end 1 @interface Person(EmailAddress) 2 @property (nonatomic,readwrite,copy)NSString *emailAddress; 3 @end 4 5 @implement Person(EmailAddress) 6 7 static char emailAddressKe... 阅读全文

posted @ 2013-04-15 11:47 cokecoffe 阅读(268) 评论(0) 推荐(0) 编辑

导航