UISplitViewController
- How can I present another TableViewController
temporarily in place of the small master ViewController
?
Normally the smaller master ViewController
on the left is embedded in a navigation controller, I want to push another ViewController
on top of it to select something and the get back to the initial one.
Looking through Apple's documentation but it hasn't clicked for me. https://developer.apple.com/library/ios/documentation/uikit/reference/uisplitviewcontroller_class/index.html#//apple_ref/occ/instm/UISplitViewController/showViewController:sender:
There is method, but it doesn't seem to work.
- (void)showViewController:(UIViewController *)vc
sender:(id)sender
You don't need to call showViewController. You need to actually include a TableView Controller and then create a segue from Master View to 2nd Table View (You do this by control-dragging from 1st VC to 2nd VC)
If your Master View Controller also contains a TableView and if you use Static Cells, then you can control+drag from cell to 2nd TableView and your job is done. 2nd TableView will open automatically when someone selects a cell on 1st TableView.
If you use Prototype cells in MasterView, then you need to call performSegueWithIdentifier
method inside didSelectRowAtIndexPath
and it will open second TableView.
All this is explained in detail in my post and link for the working code is also included. If you carefully read the post and go through the code, I am sure you will understand everything.
If you have specific questions even after reading the post, I would be happy to answer.