objective c - IBOutletCollection of UIButtons - changing selected state of buttons -


i'm having issue multiple uibuttons in view. i'd buttons selected individually, multiple selected @ time (example: 10 buttons, buttons 1, 4, 5, 9 selected).

in header have property iboutletcollection:

@property (retain, nonatomic) iboutletcollection(uibutton) nsmutablearray *buttontostayselected; 

in implementation, have ibaction:

-(ibaction)selectedbutton:(id)sender{   (uibutton *b in self.buttontostayselected) {      if (b.isselected == 0){         [b setselected:yes];   } else         [b setselected:no];   } } 

the issue i'm having when select of buttons tied collection, change selected. know problem (almost certain) lies in loop, every condition i've tried stipulate breaks code , leaves none of buttons able "change" state.

updated

to have them selectable, change state , check off multiple, used final code:

-(ibaction)selectedbutton:(id)sender {   (uibutton *b in self.buttontostayselected) {       if (sender == b) {       [b setselected:!b.isselected];     }    }   } 

thanks help!

the selectbutton: message sent argument specifies button tapped, apply action buttons in collection, not button tapped.

-(ibaction)selectedbutton:(id)sender {   (uibutton *b in self.buttontostayselected)   {      if (sender == b)      {         b.isselected == !b.isselected      }   } } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -