ios - Hide Multiple UIButton in single button click -


i have 5 buttons in xib, button 1 4 mapped

-(ibaction)btn1to4:(uibutton *)sender;  

button 5 mapped

-(ibaction)btnfive:(id)sender; 

initially 4 buttons hidden , button 5 visible, need when click on button 5 4 buttons should appear , when click again on button 5 should disappear. individual button can write code in button 5 button1.hidden=no, button2.hidden=no , soon. buttons 1 4 mapped single btn1to4 method. how should code in btnfive method hide/unhide 4 buttons @ once?

add buttons 1 through 4 iboutletcollection in interface builder. add property

@property (nonatomic, strong) iboutletcollection(uibutton) nsarray *buttons1_4; 

and drag buttons 1..4 there. here answer explaining how step-by-step.

now can operate buttons in collection using loop, rather referencing them individually:

-(void)flipbuttonsvisibility:(uibutton*)sender {     (uibutton *btn in buttons1_4) {         btn.hidden = !btn.hidden;     } } 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -