简体   繁体   中英

Change UIView / UIViewController on device orientation change

For those that use the iOS Calendar a lot, you know that when you change the orientation of the phone, another view is presented. I am not sure oof this is changing to a subview, a new UIViewController, size classes or some programatic voodoo that Apple has spun.

I can do some of the features with a subview that changes constrains on orientation change, but that is about it. It looks crude and I thought there might be a better way to imitate the Calendar App.

It most likely uses UISplitViewController to achieve this effect. This lets you display two child view controllers side by side.

You can change its preferredDisplayMode property to show or hide secondary (or primary) view controller or set it to .automatic to let it choose the most appropriate layout for the available space.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM