I've implemented a UISpliview and it works great. But I would like to add an option for the users to dismiss the masterview by pressing a button in the masterview (so it would be doing the same action, which is trickered by touching the detailview). Is this possible to do? I've update with the code, which I believe should work, but it doesn't do anything?
- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
{
barButtonItem = _backButton;
[self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
self.masterPopoverController = popoverController;
}
- (void)splitViewController:(UISplitViewController *)splitController willShowViewController: (UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
// Called when the view is shown again in the split view, invalidating the button and popover controller.
[self.navigationItem setLeftBarButtonItem:nil animated:YES];
self.masterPopoverController = nil;
}
//the action, which gets called once the button is pressed.
- (IBAction)backToFullDetailView:(id)sender
{
[self.masterPopoverController dismissPopoverAnimated:YES];
}