views:

34

answers:

2

I have read a few questions about an app doing it through the info file but not a certain view.

I just need the interface to be set up to start in landscape view.

I managed to get near what I want with shouldAutoRotateToInterfaceOrientation:, but it only works after I rotate the view.

I am kinda new to the documentation on this so I may be looking in the wrong places for this.

Any help is appreciated.

A: 

If I understand your question correctly, you need to:

  1. edit your project's info.plist file
  2. add the UIInterfaceOrientation property
  3. choose as its value one of {UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight}
Clay Bridges
I didn't explain that very well, I want my application to start in portrait, but I want a certain view that gets pushed to the nav controller to come up in landscape right away.
Alex Gosselin
What does your shouldAutoRotateToInterfaceOrientation: look like?
Clay Bridges
-(BOOL)shouldAutoRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ return toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft; }
Alex Gosselin
A: 

This is theoretical, but assuming that you have code in your shouldAutoRotateToInterfaceOrientation method that will adjust the view for display in the given interface orientation, in your viewDidLoad method, try calling your shouldAutoRotateToInterfaceOrientation method with either UIInterfaceOrientationLandscapeLeft or UIInterfaceOrientationLandscapeRight.

You say that it only works when the device is rotated, so manually calling that method as soon as the view has loaded should do the trick.

macatomy
I'm afraid it didn't work, that is asking the controller for permission to rotate the same way the view would do if the device rotated, but it doesn't carry out the rotation.
Alex Gosselin