开发者

present a different controller when the iPhone is rotated

开发者 https://www.devze.com 2022-12-15 06:44 出处:网络
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 look

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


Here's Apple's AlternateViews sample project that does exactly what you're talking about.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号