@property参数

来源:互联网 发布:网络爬虫能干什么 编辑:程序博客网 时间:2024/05/18 18:47


/*
 1.set方法内存管理相关的参数
 * retain : release旧值,retain新值(适用于OC对象类型)
   //  @property(retain)Book*book;
 * assign :直接赋值(默认,适用于非OC对象类型)
 * copy   : release
旧值,copy新值
 
 2.
是否要生成set方法
 * readwrite :
同时生成settergetter的声明、实现(默认)
 * readonly  :
只会生成getter的声明、实现
 
 3.
多线程管理
 * nonatomic :
性能高(一般就用这个)
 * atomic    :
性能低(默认)
 
 4.setter
getter方法的名称
 * setter :
决定了set方法的名称,一定要有个冒号:
 * getter :
决定了get方法的名称(一般用在BOOL类型)
 */

@interfacePerson :NSObject
//返回BOOL类型的方法名一般以is开头
@property(getter= isRich)BOOL rich;
0 0
原创粉丝点击