iPhone Stop应用程序可在视频停止时自动将方向更改为纵向 [英] iPhone Prevent application to automatically change orientation to portrait when a video stop
问题描述
我的应用程序处于横向模式,并且使用 MPMoviePlayerController 播放示例视频.效果很好,但是当我按下 OK (停止)按钮(或等到电影结束时)停止播放视频时,方向会自动变为纵向. 按下确定"按钮后,是否可以将应用程序保持在横向模式?
My application is in landscape mode and I use MPMoviePlayerController to play an sample video. It works fine but when I stop the video with the OK button (or if I wait until the movie ends), the orientation automatically changes to portrait. Is it possible to keep application in landscape mode when the OK button is pushed ?
我在主视图控制器中使用followwing代码强制使用横向模式:
I use the followwing code in my main view controller to force landscape mode :
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
推荐答案
我认为在MPMoviePlayerPlaybackDidFinishNotification通知上,您必须将statusbarorientation设置为横向.
I think on the MPMoviePlayerPlaybackDidFinishNotification notification you have to set the statusbarorientation back to landscape.
这篇关于iPhone Stop应用程序可在视频停止时自动将方向更改为纵向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!