I would like tone able to cut these lines down:
[button0 addGestureRecognizer:longPress];
[button1 addGestureRecognizer:longPress];
[button2 addGestureRecognizer:longPress];
[button3 addGestureRecognizer:longPress];
[button4 addGestureRecognizer:longPress];
[button5 addGestureRecognizer:longPress];
[button6 addGestureRecognizer:longPress];
[button7 addGestureRecognizer:longPress];
[button8 addGestureRecognizer:longPress];
[button9 addGestureRecognizer:longPress];
etc.. all the way to 36!!
Possibly with a loop? But i’m not sure how to do this.
Thanks,
Regards.
You can assign a tag to each button and loop through the buttons using the method
viewWithTag.The following screenshot shows where to assign the tag for each button in Interface Builder.
If you have setup IBOutlets for the buttons, you can obtain them using
valueForKey:and without the tag: