Reputation: 1
I want a button action that will change the button title but also will change other buttons title, I don't know how to refer those buttons (I have 9 (3X3) buttons).
Is there anyway i can refer those by their tags?
Upvotes: 0
Views: 91
Reputation: 8505
You can either create an outlet to those buttons, or grab them by their tag value:
UIButton *myButton = (UIButton *)[self.view viewWithTag:TAG_VALUE];
[myButton setTitle:@"New Title" forState:UIControlStateNormal];
The preferred iOS way is to use outlets, but you may also use the tag value of the view you're grabbing.
Upvotes: 1