0
votes

By default we can show/hide the MasterViewController of a UISplitViewController by using a left/right gesture which can be disabled by using

if ([splitViewController respondsToSelector:@selector(setPresentsWithGesture:)]) {
        [splitViewController setPresentsWithGesture:NO];
    }

now, I added a UIButtonItem to my MasterViewController and I want to control that behavior with it, how to do that?

enter image description here

1

1 Answers

0
votes

so far I could make it work by attaching this IBAction to my button:

- (IBAction)hideMasterViewController:(id)sender {


    if (!app) { app = (AppDelegate *)[[UIApplication sharedApplication] delegate]; }
    if (!currentSplitViewController) {
        currentSplitViewController  = (UISplitViewController *) app.window.rootViewController;
    }

    navController        = [currentSplitViewController.viewControllers lastObject];

    UIBarButtonItem *boton = [[[[navController childViewControllers] objectAtIndex:0] navigationItem ] leftBarButtonItem];


    [boton.target performSelector:boton.action];
}