3

I am making a view based application. For one of the xib files, I want it to only appear in landscape mode. And When i click a button in the first page it should automatically rotate to landscape and navigate to the new screen which should be in Landscape orientation.

How do i do this ?

Manu
  • 4,730
  • 2
  • 20
  • 45

2 Answers2

1

If you are using UINavigationController then you will not be able to navigate from portrait to landscape, you will need to present your new view controller modally, not to push it Check this answer Force UIViewController to only show in landscape mode

Community
  • 1
  • 1
Omar Abdelhafith
  • 21,163
  • 5
  • 52
  • 56
0

In the view that should be in landscape orientation , add this:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||  interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Leon Lucardie
  • 9,541
  • 4
  • 50
  • 70