Reputation: 35
I would like to display a different controller when the iPhone is rotated. But only on it is on a certain controller. This is very similar to what the Bloomberg app does when you are looking at a stock. Turn the device and a 3 month's chart shows up.
If there are some examples of this posted, that would be great to look at. If someone could post where they are.
thx, wes
Upvotes: 1
Views: 866
Reputation: 25775
Here's Apple's AlternateViews sample project that does exactly what you're talking about.
Upvotes: 2
Reputation: 31280
I'd first read through Apple's documentation on how to handle orientation changes. It's relatively straight forward - in your view which responds to the orientation changes, you'll want to implement -shouldAutorotateToInterfaceOrientation:
and some combination of -willRotateToInterfaceOrientation:duration:
and -didRotateToInterfaceOrientation:duration:
.
If you want separate view controllers for each orientation, I would use a "parent" view controller that responds to orientation changes and contains the logic to switch out views and view controllers based on its orientation.
Upvotes: 1