0

This is my ViewController with Signup and Login

VC in Portrait,

I am aligning the Autolayouts and it works fine in Portrait, and if i run it in Landscape mode it shows like this

VC in Landscape

and how to solve this issue?

PiyushRathi
  • 956
  • 7
  • 21
Ganesh
  • 49
  • 1
  • 8
  • If you keep your logo in centre of screen then its not possible to resolve with current layout, you need to align your buttons horizontally at the bottom so that they doesn't overlap your logo. To do so you need to set different constraints for different size class. – Dipen Panchasara Dec 12 '16 at 11:28
  • ok how to do it, because, im newbie for autolayouts @DipenPanchasara – Ganesh Dec 12 '16 at 11:34
  • you can read Apple Documentation on [Size-Class-Specific Layout](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/Size-ClassSpecificLayout.html), which will provide you all the information. – Dipen Panchasara Dec 12 '16 at 11:39
  • If you are using Xcode 8 you can refer [this documentation](https://help.apple.com/xcode/mac/8.1/index.html?localePath=en.lproj#/dev8181af7e6) – Dipen Panchasara Dec 12 '16 at 11:52
  • I have write an answer for the same, which will give you more detail. Its not full answer because it would be more complicated. – Dipen Panchasara Dec 12 '16 at 12:03
  • I recommend you to take a look in "Size Class" and "Adaptive layout", it can solve your problem easily and you can also build a better view to each kind of perspective. [Here's](https://www.raywenderlich.com/113768/adaptive-layout-tutorial-in-ios-9-getting-started) a good tutorial about adaptive layout [And here is](http://stackoverflow.com/questions/38257754/any-size-class-missing-in-xcode-8) a question in StackOverflow for Size Class I hope it help you! – Alcivanio Dec 12 '16 at 11:53

4 Answers4

1

Answered using XCode 8.1

To set different layout & constraints for different Size Classes, one need to follow given steps. Using given steps one can achieve different layout according to Size Classes.

Lets start with basic need, you must be aware about your layout.

  1. Change your Size Class to iPhone Portrait (wCxhR - width compact, height regular). Because first of all we will set constraints for it.
  2. Add all your controls and set constraints accordingly, which suits your Portrait layout design.
  3. Once you complete assignment of constraints for Portrait (wCxhR) to (wCxhC) or according to your requirement. Refer Create user interface variations for different device configurations for more details.
  4. Change your controls and constraints for Landscape layout. Thats all, run your application and check both the orientation. :)

Please find the screenshots with Different Layout according to different size classes result. Portrait Layout Landscape Layout

I believe it gives you little more understanding on how to set different layout using size class.

Dipen Panchasara
  • 13,480
  • 5
  • 47
  • 57
0

Add a constraint from Imavgeiew's bottom to first button top and set it to "Greater than or Equals 0"

CZ54
  • 5,488
  • 1
  • 24
  • 39
0
  1. Add a constraint from image view bottom to the first button, Greater than equals to 0(or other constants you like).
  2. Set the priority of constraint which makes image view center vertically to 750. You can set this by click Edit button. enter image description here
Lumialxk
  • 6,239
  • 6
  • 24
  • 47
0

Here are steps you can try
1)add centre constraints to image view
2)Give Aspect ratio
3)constraints from Top to label or give bottom to text field
4)Give Height Fix

enter image description here

Check and tell me

Krutarth Patel
  • 3,407
  • 6
  • 27
  • 54