Questions tagged «declared-property»


6
声明的属性是否需要相应的实例变量?
Objective-C 2.0中的属性是否需要声明相应的实例变量?例如,我习惯做这样的事情: MyObject.h @interface MyObject : NSObject { NSString *name; } @property (nonatomic, retain) NSString *name; @end MyObject.m @implementation @synthesize name; @end 但是,如果我改为这样做: MyObject.h @interface MyObject : NSObject { } @property (nonatomic, retain) NSString *name; @end 这仍然有效吗?它与我之前的示例有什么不同吗?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.