我在因特网上看到这段代码片段(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