[英]Changing to a different view when rotating a Split View Controller in iPad (iOS6)
我有一个iPad专用的SplitView控制器,它应该显示我在纵向模式下制作的计算器,以及在旋转到横向模式时显示的图形计算器。
这是我的故事板当前的样子,我做错了吗?
我仍然对iOS中的整个SplitView Controller概念还是陌生的,所以我不确定这整个过程如何工作。
当前,只有突出显示的视图同时以横向和纵向模式显示,但我只想以横向模式显示它,并以纵向模式显示计算器,并从纵向模式中删除显示“ Master
按钮的选项,但是以横向模式显示它,即仅在按下按钮时不以横向模式显示Master Table
。
Apple的SplitView Controller不允许在横向模式下隐藏主视图,但是您可以使用一个自定义类,例如此类。
对于屏幕旋转部分,只需在方向更改时进行模态搜索即可。
当方向改变时,这将通知您:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeOrientation:) name:UIDeviceOrientationDidChangeNotification object:nil];
然后为功能
- (void) changeOrientation : (UIDeviceOrientation) orientation {
if(!UIDeviceOrientationIsValidInterfaceOrientation(orientation))
return;
if(orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) { // Or UIDeviceOrientationPortrait
[self performSegueWithIdentifier:@"SEGUENAME" sender:self];
}
}
有关segue的更多信息: HERE
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.