0

I have one last problem with an app I just completed. On the main menu screen I support only 1 orientation and on all screens after that I support the usual 3 orientations.

The problem is that, say I am in the second screen and I hit back while I am in landscape mode, the main menu screen ends up in landscape mode as well despite the fact that I return NO on that one method. Once the menu screen is in landscape mode, I can't make it change back to its original orientation. The buttons look scrambled and obviously messy. The only solution is to go back to a 2nd screen, change the orientation there and then hit back. Is there any code I can put to make sure the orientation goes back to default when I go back to the menu screen? By the way, the problem is on both simulator and actual device when testing.

Thanks in advance

  • 2
    You need to check the orientation (of screen 1) in viewWillAppear and set the frame accordingly – Bhupesh Aug 18 '12 at 04:19
  • maybe this one help too http://stackoverflow.com/questions/181780/is-there-a-documented-way-to-set-the-iphone-orientation – mask8 Aug 18 '12 at 04:20
  • where have you implemented the orientation method in your first viewcontroller?and please post your code – Tripti Kumar Aug 18 '12 at 08:29
  • Do you only 'return NO' on your home screen? That's because you must return YES for at least one orientation. – mvb Aug 18 '12 at 15:41

1 Answers1

0

Ok guys I solved the issue, apparently leaving out that method altogether works. That method being:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

If I:

return NO 

It doesn't work even though I thought returning NO meant that it only supported portrait mode but I was wrong

Thanks to all who commented

  • Hopefully you meant to say `return (interfaceOrientation == UIInterfaceOrientationPortrait);` – jonmorgan Aug 18 '12 at 18:12
  • You are actually correct Jon, I was typing in that method wrong but it works fine too. My main problem was that I didn't understand that returning No does not equate portrait mode like I originally thought – Cristian Contreras Aug 18 '12 at 18:36