使用@property时,Xcode 4自动生成iVars,在哪里可以找到此功能的官方文档? [英] Xcode 4 automatically generates iVars when using @property,where can I find the official doc for this feature?

查看:47
本文介绍了使用@property时,Xcode 4自动生成iVars,在哪里可以找到此功能的官方文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读"Xcode的新增功能",但找不到该功能的正式说明. 在哪里可以找到官方解释?哪个文件?谢谢.

I have read "What's new in Xcode",but I can't find the official explanation for this feature. Where can I find the official explanation? Which documentation? Thanks.

推荐答案

您可以在Apple文档的 Objective-C编程语言:声明的属性.是否自动合成ivar取决于您使用的运行时:

You can find this in the Apple documentation in Objective-C Programming Language: Declared Properties under "Property Implementation Directives". Whether or not an ivar is synthesized automatically depends on what runtime you are using:

访问者综合行为的不同取决于运行时间(另请参见运行时差异"):

There are differences in the behavior of accessor synthesis that depend on the runtime (see also "Runtime Difference"):

  • 对于旧版运行时,必须已在当前类的@interface块中声明了实例变量.如果存在与属性名称相同的实例变量,并且其类型与属性的类型兼容,则使用该变量,否则会出现编译器错误.
  • 对于现代运行时(请参阅《 Objective-C运行时编程指南》中的运行时版本和平台"),实例变量根据需要进行综合.如果已经存在同名的实例变量,则使用它.

iOS始终使用现代运行时,因此您无需显式声明ivars.

iOS always uses the modern runtime so you never need to declare ivars explicitly.

这篇关于使用@property时,Xcode 4自动生成iVars,在哪里可以找到此功能的官方文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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