![](/img/trans.png)
[英]Understanding C++ enum through UIInterfaceOrientationMask for Objective-C / iOS
[英]Objective-c using UIInterfaceOrientationMask to control orientation
我有一個帶有4個viewcontrollers的應用程序。 必須僅以橫向模式呈現一個。 其他3可以是風景或肖像。
在我的部署信息區域,設備方向,我已選中顛倒,橫向左側和橫向右側。 在Info.plist中,我有3個支持的界面方向:Landscape Left,Landscape Right和Portrait Top Home Button。
在我的視圖控制器中我只想要風景我有: - (BOOL)shouldAutorotate {return YES; }
-(UIInterfaceOrientationMask) supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscapeLeft+UIInterfaceOrientationMaskLandscapeRight;
}
在其他3個視圖控制器中我有: - (BOOL)shouldAutorotate {return YES; }
-(UIInterfaceOrientationMask) supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
使用所有這些設置:1)僅應在橫向中的視圖僅在橫向中,因此這很好。 2)其他3個視圖可以橫向左側,橫向右側和縱向模式顯示,按鈕位於頂部。 3)當我嘗試在另一個縱向位置旋轉屏幕時,它不會旋轉。
因此,我更改“部署”頁面或“Info.plist”頁面以包含未選中的第4個選項。 結果是其他3個視圖旋轉正常,但橫向模式視圖現在旋轉為縱向。
我需要做什么才能獲得我的第一個視圖景觀而另外3個以任何方式旋轉?
您可以使用此鏈接來控制您的方向,這對我有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.