- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrIEntationsForWindow:(UIWindow *)window {return self.fullScreenVIDeoIsPlaying ? UIInterfaceOrIEntationMaskAllButUpsIDeDown : UIInterfaceOrIEntationMaskPortrait;@H_403_2@} @H_403_2@在我的视图控制器中显示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);}@H_403_2@然而,当用户在全屏YouTube视频上按下完成时,如果他/她仍然水平地具有电话,则呈现视图控制器也保持水平(我希望当前视图控制器是肖像).这是fullSreenVIDeoIsPlaying变量的竞赛,它没有足够快地更新,因此我的呈现视图控制器是纵向的. @H_403_2@任何有关如何实现这一目标的反馈将不胜感激. @H_403_2@谢谢!解决方法 通过将我在StackOverflow上找到的一些解决方案组合在一起来找出解决方案. @H_403_2@而不是使用此通知
[[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(windowNowVisible:) name:UIWindowDIDBecomeVisibleNotification object:self.vIEw.window ];@H_403_2@我使用以下通知
[[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(youTubeStarted:) name:@"UIMovIEPlayerControllerDIDEnterFullscreenNotification" object:nil]; [[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(youTubeFinished:) name:@"UIMovIEPlayerControllerWillExitFullscreenNotification" object:nil];@H_403_2@与实现
-(voID) youTubeStarted:(NSNotification*) notif { AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate]; appDelegate.fullScreenVIDeoIsPlaying = YES;} -(voID) youTubeFinished:(NSNotification*) notif { AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate]; appDelegate.fullScreenVIDeoIsPlaying = NO; }@H_403_2@在我的AppDelegate中,我有
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrIEntationsForWindow:(UIWindow *)window{ NSUInteger orIEntations = UIInterfaceOrIEntationMaskPortrait; if (self.fullScreenVIDeoIsPlaying) { return UIInterfaceOrIEntationMaskAllButUpsIDeDown; } else { if(self.window.rootVIEwController){ UIVIEwController *presentedVIEwController = [[(UINavigationController *)self.window.rootVIEwController vIEwControllers] lastObject]; orIEntations = [presentedVIEwController supportedInterfaceOrIEntations]; }return orIEntations; }@H_403_2@在我看来,控制器,我有
-(BOol) shouldautorotate { return NO; } -(NSUInteger)supportedInterfaceOrIEntations{ return UIInterfaceOrIEntationMaskPortrait; } - (UIInterfaceOrIEntation)preferredInterfaceOrIEntationForPresentation{ return UIInterfaceOrIEntationPortrait; }总结
以上是内存溢出为你收集整理的适用于youtube嵌入式视频的iOS 6.0自动旋转全部内容,希望文章能够帮你解决适用于youtube嵌入式视频的iOS 6.0自动旋转所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)