Reputation: 2269
I've been testing both of them and they seem to work interchangeably, but I'm just curious, is there any real difference between the two or is it just a difference in syntax?
Upvotes: 0
Views: 142
Reputation: 3830
In Objective-C you can use the dot notation or bracket notation and they are pretty much the same. I say pretty much..
Please see this thread for more details on subtle differences: Performance difference between dot notation versus method call in Objective-C
Upvotes: 0
Reputation: 40221
The dot notation is a shortcut for the getter method of that property. self.view
will be compiled as [self view]
.
Upvotes: 3
Reputation: 35788
The difference is that [self view]
is a method call, whereas self.view
is a property access. On most properties, there is no difference.
Upvotes: 1