从属性合成iVar?

问题描述

| 我可以检查一下执行以下操作时会发生什么(请参见下文),我认为在\“ INTERFACE \”中仅创建三个属性不会创建iVar。在\“ IMPLEMENTATION \”中,将这三个属性分配给名为
_window
_animationTimer
_currentFrame
的iVar,它们是由?3ѭ命令创建的?
// INTERFACE
@interface testDelegate : NSObject ... {
}
@property (nonatomic,retain) IBOutlet UIWindow *window;
@property (nonatomic,assign) NSTimer *animationTimer;
@property (nonatomic,assign) int currentFrame;
...
// IMPLEMENTATION
@implementation testDelegate
@synthesize window = _window;
@synthesize animationTimer = _animationTimer;
@synthesize currentFrame = _currentFrame;
...
    

解决方法

是的,这就是它的工作原理。 ѭ3现在可以自动生成适当的实例变量及其访问器。这是该语言中相对较新的发展。     

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...