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?
Asked
Active
Viewed 639 times
0
2 Answers
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
-
Not working bro. Not sure, but I guess it is something with CGAffineTransform. – Leo Dec 27 '13 at 11:33
-
How do you switch viewcontrollers? – Andrey Gordeev Dec 27 '13 at 11:34
-
The view controller I am talking about is, switched from the root view controller by 'presentViewController'. – Leo Dec 27 '13 at 11:53
-
This question has solution how to force an orientation change when switching between view controllers: http://stackoverflow.com/questions/19041650/ios7-ios6-conditional-rotation-portrait-landscape-for-different-sections-of – Andrey Gordeev Dec 27 '13 at 11:56
-
You can try `shouldAutorotate` return `YES` with `supportedInterfaceOrientations `. – korat prashant Dec 27 '13 at 12:31
-
`shouldAutorotate` returns `YES` by default – Andrey Gordeev Dec 27 '13 at 12:34
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