1

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.

Lev iOS
  • 11
  • 3
  • possible duplicate of [Can I use autolayout to provide different constraints for landscape and portrait orientations?](http://stackoverflow.com/questions/17772922/can-i-use-autolayout-to-provide-different-constraints-for-landscape-and-portrait) – Crazyrems Jan 23 '15 at 10:30

1 Answers1

3

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)
storyboard with any size class
(source: noelshack.com)

storyboard with compact width size class
(source: noelshack.com)

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.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Crazyrems
  • 2,551
  • 22
  • 40