Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios How To Segue From Single View To Split View Controller

Tags:

ios

ios7

segue

I have two template Views (one is a single view and the other is a Split View Controller) each individually works fine. So I put a button on the Single View and put a Push Segue on the button to go to the Split View Controller. When I press the button I get a crash saying Push cant be used from outside UI Navigation Contoller.

Ok so I put the single view template into a UI Navigation Controller and it now says: Split View Controllers cannot be pushed to a Navigation Controller.

So ... how do I do this ??

Thanks !

like image 503
drlobo Avatar asked Nov 29 '13 12:11

drlobo


2 Answers

Use a container view in a normal View Controller, covering up the whole viewing area, and that container view has an embed segue to the Split View Controller

Overwrite the UISplitViewController and put this in the viewDidLoad if you need to communicate between them:

YourLeftVC *masterViewController = (YourLeftVC *) [[self.viewControllers objectAtIndex:0] topViewController];
YourRightVC *detailViewController = [self.viewControllers objectAtIndex:1];

masterViewController.delegate = detailViewController;
like image 128
CyberMew Avatar answered Nov 15 '22 09:11

CyberMew


Instead of presenting splitviewcontroller try to set as rootviewcontroller.

self.view.window.rootViewController = splitViewController;
like image 6
miOS Avatar answered Nov 15 '22 09:11

miOS