iphone - 强制MPMoviePlayerController以横向模式播放视频 [英] iphone - force MPMoviePlayerController to play video in landscape mode

查看:100
本文介绍了iphone - 强制MPMoviePlayerController以横向模式播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序仅为纵向模式,但是当用户播放视频时,我希望它以全屏横向模式播放(视频播放器在纵向模式下看起来不太好)。我正在这样玩:

  [self.view addSubview:myMoviePlayer.view]; 
[self.myMoviePlayer setFullscreen:YES animated:YES];
[self.myMoviePlayer play];

实现这一目标的最佳方法是什么?



http://iosdevelopertips.com/video/getting-mpmovieplayercontroller-to合作-cooperate-with-ios4-3-2-ipad-and-early-versions-of-iphone-sdk.html



主要思想是:

  [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO]; 

[[自我视图] setBounds:CGRectMake(0,0,480,320)];
[[自我视图] setCenter:CGPointMake(160,240)];
[[self view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];


I have an app that is portrait mode only, but when the user plays a video I want it to play in fullscreen landscape mode (the video player doesn't look good in portrait mode). I'm playing it like this:

[self.view addSubview:myMoviePlayer.view];
[self.myMoviePlayer setFullscreen:YES animated:YES];
[self.myMoviePlayer play];

What's the best way to accomplish this?

解决方案

Read this article:

http://iosdevelopertips.com/video/getting-mpmovieplayercontroller-to-cooperate-with-ios4-3-2-ipad-and-earlier-versions-of-iphone-sdk.html

The main idea is:

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];

[[self view] setBounds:CGRectMake(0, 0, 480, 320)];
[[self view] setCenter:CGPointMake(160, 240)];
[[self view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];

这篇关于iphone - 强制MPMoviePlayerController以横向模式播放视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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