简体   繁体   中英

Xcode 6 auto layout different constraints for portrait and landscape orientation

Is there a way by which the constraints I give in portrait orientation DO NOT apply in landscape orientation and vice versa.

I am working on an app which has a lot of small images and text fields on the screen. I need to give different positions and coordinates when these are in Portrait and Landscape orientation.

With iOS8/Xcode6 there are Size Classes .

Here's all the magic:
With the same storyboard, you can set different constraints for different kind of device, with no code.

(Click to enlarge)
任何规模的故事板 具有紧凑宽度尺寸类的故事板

On the left, the regular layout. On the right, the layout when there's a compact width.

You can see that the bottom bar turns blue when you are in a specific size class, meaning you only make changes on that particular size class.

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