[英]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.