ios - UISegmentedControl to control segues -
hi creating application switch between bluetooth , wifi mode. want use uisegmentedcontrol switch between segues. photo album post example of want achieve, although done .xibs. i've tried using ibaction method segment , using performseguewithidentifier method. latter works 1 way , not vice-versa, need. though works 1 way, still error. http://imgur.com/a/pttsu
to clarify want able toggle between 2 screens, able switch screen 1 2.
if have 2 different segues, , want perform 1 based on pressed check index selected , perform segue:
- (ibaction)yoursegmentedcontrolpressed:(uisegmentedcontrol *)sender { if(sender.selectedsegmentindex==0)//left control button pressed { [self performseguewithidentifier:@"yourfirstsegue" sender:self]; } else if(sender.selectedsegmentindex==1)//right control button pressed { [self performseguewithidentifier:@"yoursecondsegue" sender:self]; } }
if want use button control segues, grab segmentedcontrol outlet , check index inside of action. note: index equal -1 if neither selected.
Comments
Post a Comment