我的应用程序中有视频.一些使用MPMoviePlayerController,其他人使用YouTube的UIWebView.我希望我的应用程序完全是肖像.但是,我想让用户选择在有视频时翻转到横向(不是强制,而是可选). 我一直在
          我一直在网上搜索答案,但我还没有找到任何答案.
谢谢你的帮助!
我有同样的问题并通过在我的app委托中添加它来修复它,基本上只允许在MPMoviePlayerViewController的子类上进行Landscape定位:#import <MediaPlayer/MediaPlayer.h>
@implementation UIViewController (orientationFix)
-(NSUInteger) supportedInterfaceOrientations
{
    if ([[self class] isSubclassOfClass:[MPMoviePlayerViewController class]]) {
        return UIInterfaceOrientationMaskLandscape;
    }
    return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    if ([[self class] isSubclassOfClass:[MPMoviePlayerViewController class]]) {
        return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
    }
    return UIInterfaceOrientationPortrait;
}
@end
@implementation MyAppDelegate
.
.
.
@end
        
             