【问题标题】:Orientation issue iOS 8方向问题 iOS 8
【发布时间】:2014-11-13 11:34:17
【问题描述】:

我的应用程序的方向有问题。应用程序仅支持纵向模式,但它使用 MPMoviePlayerViewController 播放一些视频,允许用户以横向模式查看视频。

为此,我在 AppDelegate.m 中使用了以下代码:

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {

   UINavigationController* ns = (UINavigationController*) window.rootViewController;

   if (ns && [ns respondsToSelector:@selector(visibleViewController)]) {
       UIViewController* vc = [ns visibleViewController];

         if ([vc isKindOfClass:[MPMoviePlayerViewController class]]) {
             return UIInterfaceOrientationMaskAll; 
         }
     }
     return UIInterfaceOrientationMaskPortrait; 
 }

此代码在 iOS7 中运行良好,但在 iOS8 中视频完成后,下一个视图控制器以横向模式打开。 谁能帮我解决这个问题?

【问题讨论】:

    标签: video ios8 orientation mpmovieplayercontroller


    【解决方案1】:

    请订阅此通知

    [[NSNotificationCenter defaultCenter] addObserver:self 选择器:@选择器(完成按钮点击:) 名称:MPMoviePlayerWillExitFullscreenNotification 对象:无];

    并在 doneButtonClicked 方法中执行您需要的操作

    【讨论】:

      猜你喜欢
      • 2014-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多