Difference between self.var and simply var
问题 What is the difference between using self.var vs. just var in an Objective-C class? Are there benefits or dangers to one or the other? 回答1: foo = self.var; self.var = foo; is conceptually identical to foo = [self var]; [self setVar: foo]; So using dot notation, you are really sending messages to self. foo = var; var = foo; is conceptually the same as foo = self->var; self->var = foo; So not using dot notation to access an instance variable is the same as treating self as a pointer to a C