How to make orientation rotation like built-in Calc application?

I am trying to create an application that handles orientation / rotation just like the built-in Calc application does.

If you look at this application, there is a normal calculator in portrait mode, and if you turn to landscape mode, additional buttons appear that appear on the left.

I cannot figure out how to do this by setting autosize masks. The problem is that the “normal” view of the calculator is 320 pixels in portrait mode, but in fact it is compressed to 240 pixels in landscape mode to fit additional controls.

I saw examples, for example, the AlternateViews application example, in which there are two different view controllers (one for portrait and one for landscape), but they do not seem to enliven transitions between views, as the Calc application does.

I also tried to set the framework for the views manually in the willAnimateSecondHalfOfRotationFromInterfaceOrientation file, but it doesn't seem to look “perfectly correct”, and I'm not sure how this works with the auto-resolution mask.

Any ideas how this is done? Thanks!

+4
source share
1 answer

Just override the following method call:

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

Inside this size, all of your components are resized to look good.

+2
source

Source: https://habr.com/ru/post/1309002/


All Articles