Supported orientations has no common orientation with the application, and [UIAlertController shouldAutorotate] is returning YES


某一個頁面橫屏時會出現崩潰的問題描述,原因是當你在AppDelegate中返回的設備方向是UIInterfaceOrientationMaskLandscapeLeft.但是你在視圖控制器中返回支持自動旋轉。就會拋出此異常。

解決方法 重寫UIAlertContrller 的shouldAutorotate 方法,

#import <UIKit/UIKit.h>
 
@interface UIAlertController (Rotation)
- (BOOL)shouldAutorotate;
@end


#import "UIAlertController+Rotation.h"
 
@implementation UIAlertController (Rotation)
- (BOOL)shouldAutorotate
{
    return NO;
}
@end

即可

 

by:初光夫


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM