首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MPMoviePlayerController旋转

MPMoviePlayerController旋转
EN

Stack Overflow用户
提问于 2013-12-26 18:32:54
回答 2查看 343关注 0票数 0

如何使用MPMoviePlayerController在iOS编程中旋转视频播放器。

我的代码:

代码语言:javascript
复制
moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL]; 
[self.view addSubview:moviePlayerController.view];
 moviePlayerController.fullscreen = YES;
[moviePlayerController play];
EN

回答 2

Stack Overflow用户

发布于 2013-12-26 18:46:45

尝试更改边界并旋转视图,如下所示:

代码语言:javascript
复制
[[moviePlayer view] setBounds:CGRectMake(20, 0, 480, 350)];
[[moviePlayer view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];
playerControlsContainer.hidden = YES;
票数 1
EN

Stack Overflow用户

发布于 2013-12-26 18:40:33

尝尝这个

代码语言:javascript
复制
   -(void)viewWillAppear:(BOOL)animated
      {
        [[NSNotificationCenter defaultCenter] addObserver:self  selector:@selector(ChangedmyMPMoviePlayerController :)  name:UIDeviceOrientationDidChangeNotification  object:nil];
      }


     -(void) ChangedmyMPMoviePlayerController:(NSNotification *)notification
      {
        [self adjustMPMoviePlayerController:[[UIApplication sharedApplication] statusBarOrientation]];
      }


- (void) adjustMPMoviePlayerControlle:(UIInterfaceOrientation) orientation {

if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) 
{ 
    [self.moviePlayerController setFullscreen:NO animated:YES];    
}
else if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) 
{
    [self.moviePlayerController setFullscreen:YES animated:YES]; 
}}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20783298

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档