AutoRotate ONLY MpMoviePlayerControler iOS 6

后端 未结 2 1713
名媛妹妹
名媛妹妹 2020-12-22 11:12

okay guys Same question as everyone else. I got it to work if i edited the .plist to support all orientation, but i only need to support rotation at my MPMoviePlayerControl

相关标签:
2条回答
  • 2020-12-22 11:17

    When reading your question: " I got it to work if i edited the .plist to support all orientation, but i only need to support rotation at my MPMoviePlayerController (and maybe at my MWPhotoBrwoser images)", the first remark would be that you should allow all orientations in the .plist. The allowed orientations in your plist should be the union of all orientations the different view controllers in your application must support.

    Whatever you do in a specific view controller, you will never be able to allow rotation to an orientation that is not allowed in your plist.

    It is then up to all individual view controllers to say what orientations that particular view controller allows. So in steps:

    1. Allow all orientations in the plist that are supported by at least one view controller
    2. For all individual view controllers, use the shouldAutorotateToInterfaceOrientation (iOS5) and shouldAutorotate / supportedInterfaceOrientations (iOS6)
    0 讨论(0)
  • 2020-12-22 11:37

    Add following method in AppDelegate.h

    -(NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
    {
    
        if(!ISIPAD)){
    
            if ([[self.window.rootViewController presentedViewController] isKindOfClass:[MPMoviePlayerViewController class]] && ![[self.window.rootViewController presentedViewController] isBeingDismissed])
            {
                return UIInterfaceOrientationMaskAllButUpsideDown;
            }
            else
            {
                return UIInterfaceOrientationMaskPortrait;
            }
        }
        return UIInterfaceOrientationMaskAllButUpsideDown ;
    
    }
    
    0 讨论(0)
提交回复
热议问题