转自:http://www.cnblogs.com/russelljing/archive/2012/09/24/2700616.html
XCode升级到4.5,XCode4.4 release note:The compiler automatically calls @synthesize by default for unimplemented @properties。
default 是 @synthesize propertyName = _propertyName
以后写程序可以少输入些不必要的code了。
苹果有时候对开发人员还是考虑的,虽然远不及对用户那么周到。
1. XCode并不自动添加语句到文件,而是在编译时自动生成,所以会看不到@synthesize 语句。
2. 在m文件里引用property时必须使用self.varName 或 _varName, 而不能直接使用varName
XCode 4.5更新后,对于未实现的@property,编译器默认自动调用@synthesize。此特性减少了开发者的代码输入工作量。需要注意的是,XCode在编译期间生成@synthesize语句而不是在源文件中添加;当在.m文件中引用属性时,必须使用self.varName或_varName而非直接使用varName。
985

被折叠的 条评论
为什么被折叠?



