1
votes

I am having issue with the orientation of my app. App supports only portrait mode but it plays some videos by using MPMoviePlayerViewController which allows user to view video in landscape mode.

I have used following code in AppDelegate.m for this:

- (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; 
 }

This code works fine in iOS7 but in iOS8 after video finished, the next view controller opens in landscape mode. Can any one help me to solve this issue?

1

1 Answers

0
votes

Please subscribe this notification

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doneButtonClick:) name:MPMoviePlayerWillExitFullscreenNotification object:nil];

And perform you required actions in doneButtonClicked method