diksha
diksha

Reputation: 123

Auto layout adjust bottom area in different devices IOS

How to set up different Auto Layout constraints for different screen sizes? Please see the screenshots. Please help me to how to cover the bottom space in different devices.

Iphone 7+

Iphone 7+

Iphone 7

Iphone 7

Iphone 5s

Iphone 5s

Thanks

Upvotes: 0

Views: 114

Answers (4)

Cruz
Cruz

Reputation: 2632

How about use DeviceLayout

Github https://github.com/cruisediary/DeviceLayout

you can set different Autolayout for different screen size

enter image description here

you can use cocoapod pod "DeviceLayout"

How to use

  1. install DeviceLayout using Cocoapod

  2. inherit your Auto Layout constraint (NSLayoutConstraint)

  3. set your constaint of constraint for diffent screen size

in your case, you should set bottom spacing (Login Button to Bottom Layout) auto layout inherit DeviceLayoutConstraint and setup constaint differently

Upvotes: 0

Gowtham Namuri
Gowtham Namuri

Reputation: 61

You can set constant constraint for on device and take an outlet of that constraint. We cannot use size classes for this as these devices are with Compact width and Regular height. Find the device using window or view height and change the constant value of the constraint accordingly.

Upvotes: 0

Nguyễn Anh Việt
Nguyễn Anh Việt

Reputation: 605

Put all of these UI Components into a view

With the new view's bottom constraint add these 2 constraint: greater than or equal to and less than or equal to at the same time.

Upvotes: 0

Sagar Bhut
Sagar Bhut

Reputation: 657

you give your constrain that you given..

or you try to give constrain from bottom to that..

Upvotes: 0

Related Questions