问题
I have a navigation controller based iPad application. I am using storyboards for the app design. From one of the ViewControllers in the Navigation stack, I need to segue to a screen showing splitviewcontroller. how to I go about that ?
Thanks in advance for any help on this.
回答1:
A UISplitViewController
must always be the first/main view controller you use. You can't use it from a UINavigationController
or a UITabBarController
or similar.
回答2:
I had the exact same problem and I solved it by implementing a custom segue.
@implementation LoginSegue
- (void) perform {
NSLog(@"Do the segue you way");
UIViewController *src = self.sourceViewController;
UIWindow *window = src.view.window;
[window addSubview:[self.destinationViewController view]];
window.rootViewController = self.destinationViewController;
}
@end
This seems to have worked for me. I hope this is an acceptable solution when I submit the code to apple.
来源:https://stackoverflow.com/questions/9389073/storyboard-how-to-segue-to-a-splitviewcontroller-from-a-viewcontroller-in-navi