作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我在浏览 Xcode 4.4 的发行说明时注意到了这一点:
LLVM 4.0 Compiler
Xcode now includes the Apple LLVM Compiler version 4.0, including the following newObjective-C language features:
- Default @synthesize: automatically synthesizes an @property when unimplemented
我对这个功能很感兴趣。它是如何工作的?我试过删除 @synthesize
,但没用。
最佳答案
它确实有效,请确保在您的项目和目标设置中将编译器设置为 LLVM 4.0。然后,当您删除 @synthesize 行时,您可以通过两种方式访问它:
通过带有 self.myProperty 的访问器或通过带有 _myProperty 的相应实例变量(是的,下划线是自动添加的)。
关于objective-c - 新的 Apple LLVM 4.0 "default synthesize"功能如何运作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11670715/
我是一名优秀的程序员,十分优秀!