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

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -