Search code examples
iphoneipadorientationuiinterfaceorientation

What is the better way to switch between portrait and landscape interfaces?


I have two different views (portrait and landscape) for each screen (home, user info, etc).

The difference between portrait and landscape views is enough to have each one into a different view and view controller because it's not only a relocation and resizing of controls.

To perform the switching between the two views I have a container view controller with landscapeView_ and portraitView_ properties and into

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

I do the switching.

This behavior is inherited from iPhone programming but now, in iPad, is this approach correct or it's another way to do the switching?


Solution

  • I'm fairly sure that's the best way to do it.

    You probably do this, but I would make sure you support all four orientations - they're sticklers for multiple orientations on the iPad.

    Another place to make sure everything is kosher is in your Info.plist file - adding some keys like "Initial interface orientation", "Supported interface orientations", and/or "Supported Interface Orientations (iPad)" or "... (iPhone)" can add some clarity, i.e. when you submit.