问题
So if you create a UISplitViewController with 'MasterView' and 'DetailView' setup like this
![](https://www.eimg.top/images/2020/03/25/8467f59917febb0c2ec8ab18320c6c3f.png)
in the 'MasterView' in portrait on the iPhone 6 Plus you push/show 'MasterView2' by pressing the item button and then you rotate the device I would expect to see this - 'MasterView2' | 'DetailView'
![](https://www.eimg.top/images/2020/03/25/5386fcd0e980f061d429f5791b1475eb.png)
but instead I get 'MasterView' | 'MasterView2'
![](https://www.eimg.top/images/2020/03/25/99cadf625ae001cd158db9c97a11069b.png)
How should this be setup so on rotating the iPhone 6 Plus I get the expected 'MasterView2' | 'DetailView'?
回答1:
for anyone interested here is how I solved the problem, using the splitviewcontroller delegate
- (BOOL)splitViewController:(UISplitViewController *)splitViewController
collapseSecondaryViewController:(UIViewController *)secondaryViewController
ontoPrimaryViewController:(UIViewController *)primaryViewController{
return YES;
}
- (UIViewController *)splitViewController:(UISplitViewController *)splitViewController
separateSecondaryViewControllerFromPrimaryViewController:(UIViewController *)primaryViewController{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
return [storyboard instantiateViewControllerWithIdentifier:@"detailView"];
}
来源:https://stackoverflow.com/questions/25852800/uisplitviewcontroller-rotation-master-master-on-iphone-6-plus