3

I have a navigation controller and it goes through that in portrait. Then, at a certain point, I push to a view that displays a graph, which I want to only display in landscape, and not even be in portrait at all (this screws up how the view looks).

In this view, GraphViewController, I have the following method:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

When the view first gets pushed, it appears in portrait mode. If I rotate the phone, the view will rotate into landscape also (not upside down portrait). But I want it to not even ever be in portrait mode, not even when it starts. I have verified that this method is getting called by adding a NSLog.

I saw these posts but could not get it to work. Thanks!!

Community
  • 1
  • 1
Josh Sherick
  • 2,161
  • 3
  • 20
  • 37

1 Answers1

0
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
visakh7
  • 26,380
  • 8
  • 55
  • 69
  • Uhhh no. What I'm saying is, this is not working. My view still opens up in portrait mode. Also, you gave me (in effect) the same code that I posted above. I did try it though, and the same thing happened: when the view gets pushed, it is in portrait mode. – Josh Sherick Jul 04 '11 at 16:00