iOS7 iPad Landscape only app, using UIImagePickerController

前端 未结 6 834
北荒
北荒 2020-11-29 23:16

I believe this is a common issue and many answers don\'t work anymore, many just partial, if you are under iOS7 and your iPad app is Landscape only, but you want to use the

6条回答
  •  渐次进展
    2020-11-29 23:46

    Thanks to Peter Lapisu suggestion above. It doesn't work for me (maybe i'm on iOS 8.3) but i was able to modified it to fixed my orientation issues. My codes are below

    In app delegate

    - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
    {
        return UIInterfaceOrientationMaskAll;
    }
    

    UIImagePickerController category

    @implement UIImagePickerController (extensions)
    - (BOOL)shouldAutorotate {
        return YES;
    }
    
    - (NSUInteger)supportedInterfaceOrientations {
        return UIInterfaceOrientationMaskAll;
    }
    
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
        return [[UIApplication sharedApplication] statusBarOrientation];
    }
    
    @end
    

    UIViewController category

    @implementation UIViewController (extensions)
    
    - (BOOL)shouldAutorotate {
        return YES;
    }
    
    - (NSUInteger)supportedInterfaceOrientations {
        return UIInterfaceOrientationMaskAll;
    }
    
    @end
    

提交回复
热议问题