MPMoviePlayerController全屏方向问题 [英] MPMoviePlayerController full screen orientation issue

查看:89
本文介绍了MPMoviePlayerController全屏方向问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用仅支持横向.我已经在视图控制器的视图中添加了MPMoviePlayerController.

My app supports only Landscape. I've added an MPMoviePlayerController to the view of my view controller.

当我按下全屏按钮时,它可以正常工作,并且仅在iOS 5之前的iOS版本中可以在风景"中旋转.但是,在iOS 5.0+中,它也支持纵向(仅当我进入全屏模式时).

When I press full screen button, it works fine and it will rotate in Landscape only for iOS versions prior to iOS 5. However, in iOS 5.0+, it also supports portrait (only when I enter into full screen mode).

如何在iOS 5.0及更高版本中阻止肖像支持?

How can I prevent portrait support in iOS 5.0 and above?

推荐答案

我因此解决了此问题:创建自定义导航控制器,该控制器支持2种方向: UIInterfaceOrientationLandscapeLeft&& UIInterfaceOrientationLandscapeRight

I resolved this problem thus: create custom navigation controller what support 2 orientation: UIInterfaceOrientationLandscapeLeft && UIInterfaceOrientationLandscapeRight

更多详细信息: 1.创建自定义导航控制器

More details: 1. Create custom navigation controller

CustomNavigationController.h文件

CustomNavigationController.h file

#import <UIKit/UIKit.h>

@interface CustomNavigationController : UINavigationController

-(CustomNavigationController*)initWithRootViewController:(UIViewController *)rootViewController;

@end

CustomNavigationController.m文件

CustomNavigationController.m file

@implementation IORNavigationController

-(CustomNavigationController*)initWithRootViewController:(UIViewController *)rootViewController
{
    self = [super initWithRootViewController:rootViewController];

    if (self)
    {
    }

    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

@end

2.在Appdelegate中添加自导航控制器

2.In Appdelegate add self navigation controller

Appdelegate.h

Appdelegate.h

@property (nonatomic, retain) CustomNavigationController*  navigationController;

Appdelegate.m

Appdelegate.m

self.navigationController = [[[CustomNavigationController alloc] initWithRootViewController:start] autorelease];

self.navigationController.view.autoresizesSubviews = YES;

window.rootViewController = self.navigationController;
    [self.navigationController setNavigationBarHidden:YES];

现在您有了具有两个方向和横向视频的应用程序.

And now you have app with two orientation and video in landscape orientation.

这篇关于MPMoviePlayerController全屏方向问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆