Xcode (iOS) - Switching Between Storyboards With The Press Of A Button -


this simple question, want know how i'd switch between storyboards press of button. understand how input button.

- (ibaction)button:(id)sender {      //code goes here } 

all need know though, code that'll allow me switch between storyboards.

any appreciated.

define enum this:

typedef ns_enum(nsinteger, storybordtype) {     storybordtypea = 0,     storybordtypeb,     storybordtypec }; 

then can define couple of class level properties:

@property (nonatomic, strong) uistoryboard *storyboard; @property (nonatomic, assign) storybordtype currentstoryboard; 

finally, implement button action handler this:

- (ibaction)button:(id)sender {     switch (self.currentstoryboard) {         case storybordtypea:             self.storyboard = [uistoryboard storyboardwithname:@"storybordtypeb" bundle:nil];             self.currentstoryboard = storybordtypeb;             break;          case storybordtypeb:             self.storyboard = [uistoryboard storyboardwithname:@"storybordtypec" bundle:nil];             self.currentstoryboard = storybordtypec;             break;          case storybordtypec:             self.storyboard = [uistoryboard storyboardwithname:@"storybordtypea" bundle:nil];             self.currentstoryboard = storybordtypea;             break;          default:             break;     } } 

Comments