ios - How to check if a checkbox is checked or not -
i have 2 checkboxes , in controller want able know if checkboxes checked or not. code :
in .h :
@property (weak, nonatomic) iboutlet checkbox *option1button; @property (weak, nonatomic) iboutlet checkbox *option2button; in controller.m:
- (ibaction)optionbutton1pressed:(id)sender { nslog(@"first : %lu second : %lu", (unsigned long)[_option1button state], (unsigned long)[_option2button state]); } - (ibaction)optionbutton2pressed:(id)sender { nslog(@"first : %lu second : %lu", (unsigned long)[_option1button state], (unsigned long)[_option2button state]); } the action mapped "touch inside". , can see in logs state 1 if check or uncheck checkboxes. everytime click, it's 1
i've tried "editing changed" it's never called
any idea?
i going assume checkbox derived uibutton... in case state...
so option1button.state & uicontrolstateselected want...
fyi:
enum { uicontrolstatenormal = 0, uicontrolstatehighlighted = 1 << 0, uicontrolstatedisabled = 1 << 1, uicontrolstateselected = 1 << 2, uicontrolstateapplication = 0x00ff0000, uicontrolstatereserved = 0xff000000 };
Comments
Post a Comment