Reputation: 811
Can someone please explain the difference between [self.tabBarController setSelectedIndex:1];
and self.tabBarController.selectedIndex = 1;
Upvotes: 1
Views: 92
Reputation: 1760
Both are the same, technically [self.tabBarController setSelectedIndex:1]
is calling the setter method and self.tabBarController.selectedIndex = 1;
is calling the setter using "dot syntax". Both have the same behavior.
As Apple's documentation says when using @property
the getter and setter methods for that property are generated automatically (synthesized automatically).
Also is important to know that, as @Duncan C mentioned, you can bypass the setter by setting directly the iVar.
Upvotes: 4