简体   繁体   中英

iOS Auto Layout create something similar to responsive design in CSS

Few words about the goal:

I have iPad screen that will be rotated, so it means I will have different width and height during the work app. I have two UIView on the screen. So when the device is in portrait mode the views are located like on image below:

在此处输入图片说明

When the device is in the landscape mode:

在此处输入图片说明

If the views have subviews I want to stretch them also after parent view will be modified.

Is there any way how to make it using Storyboard and auto layout feature?

You can't change the positioning of your views in the way that you're describing through one set of autolayout constraints. To achieve something like what you're describing, I suggest that you take a look at this question: Alternative iOS layouts for portrait and landscape using just one .xib file . The main solutions described are to use multiple views, multiple interface files, or to swap between two sets of autolayout constraints.

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