How to hide masterView for UISplitViewcontroller in iOS8

Everything,

I ran into a problem with the new UISplitViewcontroller in iOS8 for iPad. I have a UITableView in a storyboard in a detailViewcontroller and, by clicking on a cell, I have to go to another view called "detailinfo". I am currently using a "show" segue.

However, the current indentation just press on the right side. I want it to show full screen mode, but I don’t know how to do it, I tried to use the preferredDisplayMode property for splitViewController, as a result, it just hides the main view, but did not resize the detailView. I do not want to use the present as modal.

The current way I do

- (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 be "Jump out", which has a very bad visual effect. Hope can get any help, thanks

+6
source share
1 answer

UISplitViewController is a comprehensive view controller that consists of two child view controllers. Therefore, when you use some segue that is added to any of the child view controller, you request the child view controller to complete the session. And this child view controller has partial control of the active window.

In your case, you need to ask the split view controller to complete the session. Thus, you must add segue to the split view controller that processes the active window. This way you will have a fullscreen option.

UPDATE

If you don’t want to use the present as modal and want to avoid the “Pop out” effect, you can hide the wizard using animation

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

Source: https://habr.com/ru/post/976313/


All Articles