我在因特網上看到這段代碼片段(http://iphonedevelopment.blogspot.com/2008/12/outlets-property-vs-instance-variable.html):Objective C-定義一個屬性時定義一個實例變量
#import <UIKit/UIKit.h>
@interface MyViewController : UIViewController {
UILabel *myLabel;
}
@property (nonatomic, retain) IBOutlet UILabel *myLabel;
@end
我的問題是......當@synthesize被調用時不是自動創建的UILabel實例變量?在頭文件中創建實例變量有什麼意義?你可以用@property來獲得嗎?
[Objective-C 2.0中的屬性和實例變量]的可能重複(http://stackoverflow.com/questions/3074248/properties-and-instance-variables-in-objective-c-2-0) – Brian 2011-12-13 21:40:40