【问题标题】:IOS 6 MPMoviePlayerController Rotation IssueIOS 6 MPMoviePlayerController 旋转问题
【发布时间】:2013-01-15 23:29:13
【问题描述】:

我刚刚更新到 IOS 6,现在当我运行我的应用程序时,MPMoviePlayerControler 无法正确显示视频。该应用程序是横向的,但是当视频以纵向显示时。我创建了新的 .h 和 .m 文件,它们是 MPMoviePlayerController 的子文件。这是我的两个文件

.h

#import <Foundation/Foundation.h>
#import "cocos2d.h"
#import <MediaPlayer/MediaPlayer.h>

@interface TrashPackPlayer : MPMoviePlayerController

@end

.m

#import "TrashPackPlayer.h"

@implementation TrashPackPlayer

-(id)init{
    [super init];
    return self;
}

- (BOOL)shouldAutorotate
{
    return YES;
}

- (NSInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

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

@end

我这样创建媒体播放器:

player = [[TrashPackPlayer alloc] initWithContentURL:videoURL];
    player.view.frame = CGRectMake(0, 0, sharedInfo.screenSize.width, sharedInfo.screenSize.height);
    player.controlStyle = MPMovieControlStyleFullscreen;
    player.scalingMode = MPMovieScalingModeAspectFit;
    [player play];

    [[[CCDirector sharedDirector] openGLView] addSubview:player.view];

这对吗?

我需要做什么才能正确显示?

【问题讨论】:

    标签: ios6 cocos2d-iphone orientation


    【解决方案1】:

    iOS6 中的旋转发生了巨大变化,请查看第四点: http://megawertz.com/blog/2012/9/20/ios-6-and-rotation

    最顶层的视图控制器负责设置允许的方向,子类化视图控制器并不能解决您的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      • 1970-01-01
      相关资源
      最近更新 更多