objective c - Segemented Control for iPhone not working -
i have segmented control following code in action method:
-(ibaction)togglecontrols:(id)sender{ if([sender selectedsegmentindex] == kswitchessegmentindex){ leftswitch.hidden = no; rightswitch.hidden = no; dosomethingbutton.hidden = yes; } else{ leftswitch.hidden = yes; rightswitch.hidden = yes; dosomethingbutton.hidden = no; } } however, when run program i'm getting error kswitchessegmentindex. it's saying kswitchessegmentindex undeclared identifier. can me what's wrong here?
you have show kswitchessegmentindex being defined. convention define variables like:
#define kswitchessegmentindex 1 or, define int:
int kswitchessegmentindex = 1; since shouldn't need change value first choice might best.
example:
#include <avfoundation/avfoundation.h> #define kmyconstant1 0 #define kmyconstant2 1 @implementation myclass
Comments
Post a Comment