aclass.h
@interface aClass : NSObject {
NSString *name;
}
@property (nonatomic, retain) IBOutlet NSString *name;
@end
aclass.m
self.name
uses the accessor and/or mutator defined by you (this is nonatomic and retain in your case). So when you call self.name = foo
, it will call the setName:(NSString *)str
mutator generated by the compiler, which will first release the current string, then retains the new string and finally sets name to the retained string.
Just calling name = foo
does nothing more than assigning name to foo.
This also means that you can only call self.xxx
when you have defined a property for the ivar, otherwise the compiler will tell you that it doesn't know about it(iVar).