MPMoviePlayerViewController

MPMoviePlayerViewController

我的问题很简单,教程和答案并不能解决我的问题。
我有一个带有设置的应用程序:


我想在所有viewController中仅支持纵向/上下颠倒方向,除非要通过以下方式播放视频:


  MPMoviePlayerViewController


这是代码:

MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:[Videos videoURL:video.hash]];
if (mp) {
    isVideoPlaying = YES;

    [[NSNotificationCenter defaultCenter]
     addObserver:self
     selector:@selector(videoFinishedPlaying:)
     name:MPMoviePlayerPlaybackDidFinishNotification
     object:mp.moviePlayer];

    [self presentMoviePlayerViewControllerAnimated:mp];
    mp.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
    [mp.moviePlayer play];
    [mp release];
}


MPMoviePlayerViewController播放视频时,我希望支持所有方向。
需要你的帮助。

最佳答案

您应通过以下方式允许旋转:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
     // Return YES for supported orientations
}


iOS 6:

- (NSUInteger)supportedInterfaceOrientations
{

    return UIInterfaceOrientationMaskAll;
}


将代码放在调用播放器的.m文件中

关于ios - 横向/所有方向上的MPMoviePlayerViewController,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14518894/

10-10 21:13