What is the difference between self.variable and self->variable?
问题 I have seen accessing variable in iphone sdk with -> or . symbol.Which one is the best?what is the difference between self.variable and self->variable? 回答1: The dot-notation goes through the accessor, the arrow notation goes directly to the instance variable. Try this code: @interface Foo : NSObject @property(assign, nonatomic) NSInteger bar; @end @implementation Foo @synthesize bar; - (void) setBar: (NSInteger) newBar { NSLog(@"Setting new bar."); bar = newBar; } - (id) init { self = [super