-4

I have an X-Code project where it is Portrait and it does not move from that. It is always on Portrait. How can I make it so that 1 page, by default, it is landscape?

If you can go into as much detail as possible, that would be great. I am newer to X-Code.

Cameron Tarbell
  • 134
  • 3
  • 8

2 Answers2

1

You can do something like this

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return UIInterfaceOrientationIsLandscapeRight(toInterfaceOrientation);
}

-(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscapeRight;
}
Bot
  • 11,868
  • 11
  • 75
  • 131
  • where do i implement this into my app? the class files that I used for the page i want to make landscape? – Cameron Tarbell Oct 18 '13 at 22:14
  • @CameronTarbell correct, the root view controller that you want landscape. If it is a further view down in the hierarchy you may need to send a notification message to the parent and have it change the view at the parent level. – Bot Oct 21 '13 at 16:15
1

Follow those two steps on screenshot and you would be able to choose any orientation you want!

enter image description here

Or if you want it for specific view follow this.

Community
  • 1
  • 1
cojoj
  • 6,405
  • 4
  • 30
  • 52
  • yeah I know that part but i'm saying that I want to make it so that 1 view controller is landscape and not the entire project. – Cameron Tarbell Oct 18 '13 at 22:14
  • He wants it for a single view. Your specific view also only checks if the device is already rotated and not forcing it to a landscape view if it is in portrait mode. – Bot Oct 21 '13 at 16:13