In xcode 4 I am unable to lock the screen orientation to only portrait even though I have portrait selected only. How to I do this programmatically?
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
this code works in a new blank project
For each view controller (or just the parent), implement
-shouldAutorotateToInterfaceOrientation:Set the default orientation to portrait and then do:Alternately, you can do:
which will allow a rotation to portrait but not away from it.