我只想在iOS应用程序的所有视图控制器中支持垂直方向。但是,我在其中一个视图控制器中嵌入了一个YouTube视频,当选择该视频占用全屏幕时,我希望用户能够水平定位他/她的手机,以便视频扩展为全屏。适用于YouTube嵌入式视频的iOS 6.0+自转
编辑:我尝试使用以下代码从Autorotate in iOS 6 has strange behaviour:
- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return self.fullScreenVideoIsPlaying ?
UIInterfaceOrientationMaskAllButUpsideDown :
UIInterfaceOrientationMaskPortrait;
}
并且在呈现UIWebView
/YouTube的帧我的视图控制器,我已经在这个代码我viewDidLoad
:
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(windowNowVisible:)
name:UIWindowDidBecomeVisibleNotification
object:self.view.window
];
- (void)windowNowVisible:(NSNotification *)notification
{
AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
appDelegate.fullScreenVideoIsPlaying = !(appDelegate.fullScreenVideoIsPlaying);
}
但是,当用户按下全屏YouTube视频完成后,如果他/她仍然有电话rizontally,那么呈现视图控制器也保持水平(我希望当前的视图控制器是肖像)。这是一个fullSreenVideoIsPlaying
变量的比赛,它的更新速度不够快,所以我的演示视图控制器是纵向的。
任何有关如何实现这一目标的反馈将不胜感激。
谢谢!
你可以阅读 - http://buddingdevelopers.com/autorotation-in-ios/自转清楚地说明如下。 – Xcoder 2013-05-03 05:56:33
可能的重复:http://stackoverflow.com/questions/13580753/mpmovieplayercontroller-rotating-in-full-screen-while-the-parent-view-controller – 2013-05-09 04:46:59