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?

malinois
  • 6,644
  • 3
  • 34
  • 55
Leo
  • 135
  • 1
  • 2
  • 17

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
  • 27,503
  • 11
  • 123
  • 150
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,842
  • 9
  • 49
  • 82