开发者

How to do orientation rotation like built-in Calc app?

开发者 https://www.devze.com 2022-12-29 15:39 出处:网络
I\'m trying to make an app that handles orientation/rotation similarly to the way the built-in Calc app does.

I'm trying to make an app that handles orientation/rotation similarly to the way the built-in Calc app does.

If you check out that app, in portrait mode there's a normal calculator, and if you rotate to l开发者_高级运维andscape mode there are additional buttons that appear to the left.

I can't figure out how to do this by setting the autosize masks. The problem is the "normal" calculator view is 320px wide in portrait mode, but actually shrinks to around 240px in landscape mode to fit the additional controls.

I've seen examples like the AlternateViews sample app that have two different view controllers (one for portrait and one for landscape), but they don't seem to animate the transitions between the views nicely like the Calc app does.

I've also tried setting the frames for the views manually in willAnimateSecondHalfOfRotationFromInterfaceOrientation, but it doesn't seem to look "quite right" and also I'm not certain how that works with the autoresize mask.

Any ideas how this is done? Thanks!


Just override the following method call:

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

Inside of there resize all of your components so they look nice.

0

精彩评论

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