Support different orientation for only one view iOS 6

后端 未结 7 1028
时光说笑
时光说笑 2020-11-29 03:57

I want to rotate ONLY one of my views within my app to either landscape left or landscape right. All my other views are in portrait mode and I have set my app to support onl

相关标签:
7条回答
  • 2020-11-29 04:50

    Defiantly work Please try. I solve after 2 days

    //AppDelegate.m - this method is not available pre-iOS6 unfortunately

    - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
    NSUInteger orientations = UIInterfaceOrientationMaskAllButUpsideDown;
    
    if(self.window.rootViewController){
        UIViewController *presentedViewController = [[(UINavigationController *)self.window.rootViewController viewControllers] lastObject];
        orientations = [presentedViewController supportedInterfaceOrientations];
    }
    
    return orientations;
    }
    

    //MyViewController.m - return whatever orientations you want to support for each UIViewController

    - (NSUInteger)supportedInterfaceOrientations{
        return UIInterfaceOrientationMaskPortrait;
    }
    
    0 讨论(0)
提交回复
热议问题