[英]view does not rotate when orientation is upsidesidedown in ios 7
我試圖使應用程序支持所有方向。 它的工作正常,但只有倒置方向無效。 我正在使用ios7。 對於倒置,視圖不旋轉。 我嘗試了以下代碼
-(BOOL)shouldAutorotate
{
return yes;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll; // etc
}
我唯一的第二種方法叫做,但第一種方法不是。 在infoPlist中,我啟用了所有受支持的方向。
找到了解決方法。 主要來源: https : //stackoverflow.com/a/12758715/394969
概括地說,首先登陸這里的人:
/* In your view controller */
// Add support for upside down
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
也可以按@Jignesh Mayani的答案中所述在項目設置中翻轉所有設備方向。 如果那不能立即解決您的問題,請檢查上面的鏈接,了解如何使用導航控制器和選項卡控制器(它們都必須支持所需的界面方向)。
確認您已檢查,進入項目設置並檢查
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.