可能重复:
How does an underscore in front of a variable in a cocoa objective-c class work?属性名称的下划线前缀?
任何人都可以点我使用下划线的解释,我一直认为它们是用来突出显示您正在访问的伊娃[_window release];
而不是通过setter/getter方法访问iVar [[self window] release];
或[self.window release];
我只想验证我的理解是否正确。
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UILabel *markerLabel;
@synthesize window = _window;
@synthesize markerLabel = _markerLabel;
这就是我使用它们的原因。 – 2011-04-07 14:25:30
这用于指向这个其他的愚蠢,这也是有趣的太http://stackoverflow.com/questions/3521254/prefixing-property-names-with-an-underscore-in-objective-c – 2012-08-22 03:43:45