Question

A Question was asked earlier. And i was facing the same issue where the Movie player was not rotating as the project properties didn't allowed to rotate. This issue was only faced in iOS7 over iPhone so i am trying another work around where i enable all the orientation in project Properties but the issue is that when ever i disable the rotation in other view controllers through functions like this

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
     return FALSE;
}

// Tell the system what we support
-(NSUInteger)supportedInterfaceOrientations
 {
return UIInterfaceOrientationPortrait;
}

- (BOOL) shouldAutorotate {
return NO;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;

}

The view controllers still rotate which i suppose that this is because its allowed in project properties.

So the Question is..

How can i disable Rotation in a specific Media Player View Controller when Project settings allows all rotation?

OR

How can i Override rotation in a specific Media Player view controller over project properties (Disabling rotation) which doesn't work in iOS7

Was it helpful?

Solution

you can implement below method in you AppDelegate class it's working for me:

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

    if ([[window.rootViewController presentedViewController] isKindOfClass:[MPMoviePlayerViewController class]])
    {
        return UIInterfaceOrientationMaskAllButUpsideDown;
    }
    else
    {
        return UIInterfaceOrientationMaskPortrait;
    }
}

OTHER TIPS

When we are talking about orientation, they are 2 things that come into the picture:

Device Orientation Interface Orientation As its clear by the name only, Device orientation tells, in which orientation device is, and Interface orientation says in which orientation your app is presenting its interface.

Here what you are doing is, your app is supporting all orientation. You must have check marked all orientations in project.

Now when you are changing orientation of device from portrait to landscape, when you have set interfaceOrientation to be in portrait mode programmatically, this is what happens. As device orientation is changes, orientation of your status bar also changes. But as you have restricted interface of your app to be in portrait orientation, its not changing its orientation..

So this is what you can do:

Uncheck landscape orientation support for your app & check if problem persists. Let me know what happened when you followed first step :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top