I have a storyboard that has a ViewController DefaultViewController which is neither a UITabBarController nor a ‘UINavigationController`. It decides whether the upcoming controller should be a registration screen or home screen.
I have two segues originating from it, one pointing to UINavigationController' that does registration while other moves to 'UITabBarController that is the default home screen.
The DefaultViewController calls does following in ViewDidAppear: method
NSString *theController = nil;
if ([AppState sharedAppState].currentUserState == Registered) {
theController = @"HomeSegue";
} else {
theController = @"RegSegue";
}
[self performSegueWithIdentifier:theController sender:self];
The segue is performed well on iOS Simulator 5.1.1 as well as 6.0. However, nothing happens when I run the code on iPhone with iOS 5.1.1 or iPhone with iOS 6.0. The view stays with DefaultViewControllers view.
EDIT
I created whole new project and works fine there but when I copied old storyboard contents and classes, issue re-appears.. !!
** EDIT 2 **
I removed the RootViewController associated with UINavigationController and added a simple UIViewController with a label on it and it works fine. If I add my Custom RegistrationController as root controller, the segue is not performed.
P.S. My custom RegistrationController adds another controller as childViewController in it.
Strange .. Very Very Strage.. But that is how I got it to work.
The
RegistrationControllerthat was part of navigationController, created an instance ofRegInfoControllerwhich was added as both as it’s subview as well as child controller.I simply overrid the
awakeFromNibmethod of that childController and it started working.To Confirm the scenario, I removed the method and it stopped working..