About Setter and Getter
2011-12-10 14:05
369 查看
通过property声明和synthesize定义,Objective C自动生成了getter和setter。而且功能和上面的代码完全一样。
下面讲解一下property里声明的属性。
@property(nonatomic, retain) NSString *text 意为:我有个成员叫text,无需多线程保护,在setter里要使用retain/release过程。
@property(nonatomic, assign) int value 意为:我有个成员叫value,无需多线程保护,在setter里直接赋值就可以,不需要引用计数机制介入。
if you wanna know more please click the following link .
http://blog.csdn.net/ba_jie/article/details/6947451
by Tom Callon
下面讲解一下property里声明的属性。
@property(nonatomic, retain) NSString *text 意为:我有个成员叫text,无需多线程保护,在setter里要使用retain/release过程。
@property(nonatomic, assign) int value 意为:我有个成员叫value,无需多线程保护,在setter里直接赋值就可以,不需要引用计数机制介入。
if you wanna know more please click the following link .
http://blog.csdn.net/ba_jie/article/details/6947451
by Tom Callon
相关文章推荐
- Auto-generate LotusScript setter and getter properties for class variables
- defineGetter and defineSetter in Firefox
- 从零开始学android开发-自动产生getter and setter
- Getter and setter
- scala getter and setter
- 在反射中如何调用类中的Setter()AndGetter()方法
- Getter And Setter取消前缀
- Why getter and setter methods are evil
- OO设计精要:封装,还是封装(有感于“Why getter and setter methods are evil ”by Allen Holub )
- [Ramda] Getter and Setter in Ramda & lens
- Javascript Getter/Setter and prototype(extend dom)
- InterlliJ 定制Getter and Setter分享
- Let Us Fuck Up Getter And Setter (1)- Java Object Properties Copy
- as3——跳出方法,getter and setter,子类实施超类的译本
- Eclipse中generate getter and setter对boolean的反应
- ES6 getter and setter
- Intellij IDEA 自定义 getter and setter
- iOS 中 setter and getter
- @synthesize 何时用?:当同时实现setter and getter
- __defineGetter__ and __defineSetter__