0

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?

Pfitz
  • 7,336
  • 4
  • 38
  • 51

1 Answers1

1

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.

Community
  • 1
  • 1
mopsled
  • 8,445
  • 1
  • 38
  • 40