It’s been 3 days since I’ve programmed in objective-C and I still don’t quite understand the concept of self.
When should we use a self. in an implementation code?
If I understand this correctly if I have defined it as a property then I should use self.
But then the question is why? I’ve been reading many i-phone programming books but none doesn’t seem to give me a strong and clear answer. Is self the same as this in other programming languages such as java?
selfis roughly equivalent tothisin other languages. Also, the dot-notation introduced in Objective-C 2.0 can mask what is really happening.The above is the same as
selfis actually just a variable that is automatically passed to class and instance methods. This is what makes it possible to do: