0

I want to open a sepcific view controller of my application always in UIInterfaceOrientationLandscapeRight. No other orientantion. How can I do this in iOS 7?

Michaël
  • 6,676
  • 3
  • 36
  • 55
Leo
  • 135
  • 1
  • 2
  • 18

2 Answers2

0

Use UIViewController's supportedInterfaceOrientations method:

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationLandscapeRight;
}

Apple's documentation: https://developer.apple.com/LIBRARY/IOS/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/supportedInterfaceOrientations

Andrey Gordeev
  • 30,606
  • 13
  • 135
  • 162
0

irst import this

#import <objc/message.h>

and in viewDidAppear

-(void)viewDidAppear:(BOOL)animated
{
           objc_msgSend([UIDevice currentDevice], @selector(setOrientation:), UIInterfaceOrientationLandscapeRight );
}
Sunny Shah
  • 12,990
  • 9
  • 50
  • 86