[英]Changing complete project orientation in ios
當用戶將設備橫向的方向更改為縱向模式時,應更改我的應用的完整方向,如何不針對特定視圖更改完整的應用方向,我需要更改整個應用
轉到目標->支持的設備方向->選擇所需的方向
編輯
嘗試這個
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
// return YES;
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
來自Apple.developer:基於iOS的設備中的加速度計可以確定設備的當前方向。 默認情況下,應用程序支持縱向和橫向。 當基於iOS的設備的方向發生變化時,系統會發出UIDeviceOrientationDidChangeNotification通知,以使任何感興趣的各方都知道發生了這種變化。 默認情況下,UIKit框架偵聽此通知,並使用它自動更新您的界面方向。 這意味着,除了少數例外,您根本不需要處理此通知。
實現supportedInterfaceOrientations方法
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft;
}
在這里查看更多詳細信息
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.