Make UIViewController be in iOS7 landscape mode

I implemented the correct functions, but they do not work? I tried several solutions here on StackOverFlow, but none of them work. I tried to add a view to the UINavigationController, also not working.

FakeIDDetailViewController.h:

@interface FakeIDDetailViewController : UIViewController
@end

FakeIDDetailViewController.m:

@interface FakeIDDetailViewController ()

-(BOOL)shouldAutorotate
{
    return NO;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (UIInterfaceOrientationMaskLandscapeLeft);
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeLeft;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeLeft;
}

- (NSUInteger) application:(UIApplication *)application     supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    return UIInterfaceOrientationLandscapeLeft;
}
+3
source share
2 answers

If you push the view controller onto the stack of other view controllers in the navigation controller, requiring that only the landscape does not work very well. You must display a view controller with terrain restrictions.

See my answer here for a sample project: fooobar.com/questions/226387 / ...

+4

All Articles