请问X $ C $ç4.5.2自动美元,为p $ PFIX合成BOOL干将 [英] Does Xcode 4.5.2 automatically prefix synthesized BOOL getters with is

查看:158
本文介绍了请问X $ C $ç4.5.2自动美元,为p $ PFIX合成BOOL干将的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只注意到我有一个BOOL声明为 @属性(非原子,分配)BOOL userAuthorized; ,我正要写我自己的getter它和自动点¯x code自动完成与 - (BOOL)isUserAuthorized

I just noticed that I had a BOOL declared as @property (nonatomic, assign) BOOL userAuthorized; and I was about to write my own getter for it and automatically Xcode autocompleted with - (BOOL)isUserAuthorized

所以我怀疑这是没有必要再编写 @属性(非原子,分配,吸气= isUserAuthorized)BOOL userAuthorized;

So I suspect it's not necessary anymore to write @property (nonatomic, assign, getter = isUserAuthorized) BOOL userAuthorized; ?

推荐答案

显然,如果你提供自己实施 BOOL 吸气时,编译器足够聪明弄清楚该 isActive 有效属性的getter。

Apparently if you provide your own implementation of the BOOL getter, the compiler is smart enough to figure out that isActive is the getter for the active property.

不过,如果你合成你还是要提供吸气的getter = isActive ,以便使用该签名的吸气剂,而不是有效

Nonetheless if you synthesize the getter you still have to provide getter=isActive in order to use that signature for the getter instead of active.

这篇关于请问X $ C $ç4.5.2自动美元,为p $ PFIX合成BOOL干将的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆