I am aware that this questions has been asked before but Im yet to find a solution. In Xcode 5 i would like to lock my application to landscape right. Here are the steps i have taken to set up the project.
(1) Create a Single View project
(2) Set Device Orientation to Landscape Right under the general settings tab
(3) Set the View Controller Orientation to Landscape in main.storyboard
(4) Add the following code to ViewController.m
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return interfaceOrientation == UIInterfaceOrientationLandscapeRight;
}
-(NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationLandscapeRight;
}
(5) Add the following code to ViewController viewdidLoad
NSLog(@"frame %f %f", self.view.frame.size.width, self.view.frame.size.height);
Every time i run the app my view is 320 x 568
What do i need to set to get the view in landscape (568 x 320).
Thank you.