1

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:

enter image description here

When the device is in the landscape mode:

enter image description here

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?

Matrosov Oleksandr
  • 25,505
  • 44
  • 151
  • 277
  • Check out the answer to this http://stackoverflow.com/questions/16729302/two-views-one-below-another-in-portrait-and-side-by-side-in-landscape-using-lay/16731755#16731755 – Mike Pollard Aug 20 '14 at 16:25

1 Answers1

1

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.

Community
  • 1
  • 1
Kamaros
  • 4,536
  • 1
  • 24
  • 39
  • thank you for the answer, maybe this is a solution for xibs, but I am using storyboards instead. – Matrosov Oleksandr Aug 25 '14 at 12:06
  • The first and last solutions that I mentioned can both be applied to Storyboards. As for the second, switching between xib files, the equivalent with storyboards is to have two view controllers in your storyboard and to segue between them when the orientation changes. This is the method recommended by Apple: https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/RespondingtoDeviceOrientationChanges/RespondingtoDeviceOrientationChanges.html#//apple_ref/doc/uid/TP40007457-CH7-SW14. – Kamaros Aug 25 '14 at 12:51