我正在开发一个应用程序,其中我只使用一个方向,即纵向。这是设备方向设置:
但是在我的应用程序中,有一个视频播放器(自定义播放器MPMoviePlayerViewController
),我只想在横向右模式下显示它,它不应该被旋转。这工作正常,我的意思是这个自定义播放器完美地显示在横向右侧,但是当我使用UIAlertview
then 应用程序时,这个方法会崩溃:
- (BOOL)shouldAutorotate {
return NO;
}
这些是其他一些定位方法:
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationLandscapeRight; // or Right of course
}
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
- (NSUInteger)supportedInterfaceOrientations
#else
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
#endif
{
return UIInterfaceOrientationMaskLandscape;
}
我收到此错误:
*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [UIAlertController shouldAutorotate] is returning YES'