当你执行以下操作时,我可以检查一下发生了什么吗(见下文),我正确地认为在“iVars”中没有创建接口,只有三个属性。在“实现”中,这三个属性被分配给由@synthesize命令创建的名为_window、_animationTimer和_currentFrame的iVars。
// 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;
...发布于 2011-05-25 23:20:01
是的,它就是这样工作的。@synthesize现在可以自动生成适当的实例变量以及它们的访问器。这是该语言中相对较新的发展。
https://stackoverflow.com/questions/6126778
复制相似问题