Reputation: 123
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 5s
Thanks
Upvotes: 0
Views: 114
Reputation: 2632
How about use DeviceLayout
Github https://github.com/cruisediary/DeviceLayout
you can set different Autolayout for different screen size
you can use cocoapod pod "DeviceLayout"
How to use
install DeviceLayout
using Cocoapod
inherit your Auto Layout constraint (NSLayoutConstraint)
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
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
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
Reputation: 657
you give your constrain that you given..
or you try to give constrain from bottom to that..
Upvotes: 0