Is there a shortcut for this code?
-(IBAction)reset{
button1.hidden=NO;
button2.hidden=NO;
button3.hidden=NO;
button4.hidden=NO;
button5.hidden=NO;
button6.hidden=NO;
button7.hidden=NO;
button8.hidden=NO;
button9.hidden=NO;
button10.hidden=NO;
button11.hidden=NO;
button12.hidden=NO;
button13.hidden=NO;
button14.hidden=NO;
button15.hidden=NO;
button16.hidden=NO;
button17.hidden=NO;
button18.hidden=NO;
button19.hidden=NO;
button20.hidden=NO;
button21.hidden=NO;
button22.hidden=NO;
button23.hidden=NO;
button24.hidden=NO;
button25.hidden=NO;
button26.hidden=NO;
button27.hidden=NO;
button28.hidden=NO;
button29.hidden=NO;
button30.hidden=NO;
button31.hidden=NO;
button32.hidden=NO;
button33.hidden=NO;
button34.hidden=NO;
button35.hidden=NO;
}
There definitely must be ways for that 🙂 It really depends on how you create and store your buttons. You can store them in array and process them in a loop:
You can also assign a unique
tagproperty to a UIButton when you create them (this property is defined inUIViewand available in all its subclasses). This way you do not need separate storage for buttons and you can also hide them in a loop: