当我宣布一个NSString
我简单地做:IOS:财产和自我
NSString * my_string; (in interface of my .h)
如果我想允许访问从其他类此字符串我这样
property (nonatomic, strong) NSString *my_string;
添加属性而我写的合成
synthesize my_string; (in .m)
现在我的一些问题:
- 如果我使用一个属性,我还必须在接口中使用简单声明吗?
- 如果我使用
my_string
作为属性,我必须以前总是使用self.
吗? - 如果我使用一个属性,是否有必要为每个属性编写
@synthesize
? (因为我看到,有时是没有必要的。
“xcode将合成”,这将是'clang'。 – trojanfoe