简体   繁体   中英

How to create an iPad layout which has 2 columns in portrait mode and 3 in landscape?

I need to create an application for ipad which has different layouting in portrait and landscape mode. First of all it has 2 column views in landscape like UISplitViewController and in landscape mode it has 3 column layout. The 3rd (hidden) column in landscape mode also should have been able to bring in forward. It should be like Navigation Drawer in android.

I done some research and find a solution that I should create a separate view for landscape and separate view for portrait mode. I don't know if it is good way to do that. Please feel free to advice me any solution. Thank You.

edit:

Can it be achieved with size classes? or the need of use 3rd party library to achieve a navigation drawer like look needs to separate the portrait and landscape views into 2 different views?

So my solution is. You need to have 3 views. Each view is just a container for your viewControllers or stuff like that. After You turn your device You could adjust the constrains of these views so You can actually hide one in portrait mode. You can add some fancy animation if it is needed. The Drawer is created as different view, there are several libraries on the github for it. So for example after turning into the portrait mode you set your first column width to 0 and the width constrain of other two columns to screenSize/2 and you enable the navigation bar item which triggers your implemented drawer.

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