6
votes

All,

I have met a problem with new UISplitViewcontroller in IOS8 for iPad. I have a UITableView in the storyboard in the detailViewcontroller and on clicking the cell, I should go to the another view called "detailinfo". I am current using a "show" segue.

However, the current segue just push on the right part. I wanna it show fullscreen , but I dont know how to make it, I tried using preferredDisplayMode property of the splitViewController , the result is it just hide the master view but didnt resize the detailView. I dont wanna using present as modal.

current way I am doing is

        - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if([[segue identifier]isEqualToString:@"showStudentDetail"]){

        if(self.traitCollection.horizontalSizeClass != UIUserInterfaceSizeClassCompact){
            UISplitViewController *splitViewController = (UISplitViewController *)self.navigationController.parentViewController;
            splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModePrimaryHidden;
        }

    }
}

and in viewDidAppear, using

- (void)viewDidAppear:(BOOL)animated {

    if(self.traitCollection.horizontalSizeClass != UIUserInterfaceSizeClassCompact){
        UISplitViewController *splitViewController = (UISplitViewController *)self.navigationController.parentViewController;
        splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeAutomatic;
    }
}

This will work , but the masterViewController will "Jump out" which has a very bad visual effect. Hope can get any help , thank you

1

1 Answers

4
votes

UISplitViewController is a complex view controller which consists of two child view controllers. So when you use some segue which is added to any of the child view controller you ask child view controller to perform the segue. And this child view controller has partial control of active window.

In your case you need to ask the split view controller to perform the segue. So you should add the segue to your split view controller which handles active window. This way you will have the fullscreen option.

UPDATE

If you dont wanna using present as modal and want to avoid "Jump out" effect you can hide master using animation

UISplitViewController *splitViewController = [self splitViewController];
[UIView animateWithDuration:0.25 animations:^{
    splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModePrimaryHidden;
} completion:^(BOOL finished) {
    [splitViewController showDetailViewController:vc sender:nil];
}];