Possible Duplicate:
Synthesized property and variable with underscore prefix: what does this mean?
I've seen both of these in code; what's the difference?
@synthesize fooBar;
@synthesize fooBar=_fooBar;
@synthesize fooBar;
creates accessors for the property fooBar
using an instance variable with the same name for storage, while the =_fooBar
tells the compiler to use the instance variable named _fooBar
as storage instead. You don't need to use the =...
if you have your instance variables and properties identically named, and you do otherwise.
精彩评论