When a user moves their iPhone, my views switch appropriately between portrait and landscape mode with no problem using the following code:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait ||
interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
The problem is, if they press a button that takes them to another screen after the rotating to landscape, then the next screen goes back to portrait mode and the status bar correctly remains in landscape mode. How do I detect which mode the iPhone currently is in during a onviewload so that i can run the change the change the view orientation appropriately?