Sonic
Sonic

Reputation: 518

How to make Auto Layout for Universal App

I'm now doing an universal app; I faced a problems on auto layout; I need to make two views with same size on all devices; I worked on storyboard with view wAny hAny; and here the images I reach enter image description here

The problem on iPad the bottom view it's very big and I need these two vies almost same height like on the attached photo for iPhone-4inch

The following photos shown my constrains The following for top view enter image description here and the following for bottom view enter image description here

if i do equal height there's the photo enter image description here and herewith the constrains enter image description here and here the output enter image description here

here the modification as you see iPad is problem bottom view layout topView bottom View

Upvotes: 3

Views: 1093

Answers (2)

iCaramba
iCaramba

Reputation: 2640

On the upper view set left right and top constraint, on the lower view set bottom, equal width, align leading and equal Heights. Set vertial spacing between both views.

Equal spacing

Upvotes: 1

rdelmar
rdelmar

Reputation: 104082

If you want the two views to be the same height, give them an equal height constraint, and eliminate the constraint between the bottom view and the top of the superview. You make an equal height constraint by selecting both views and choosing "Equal Heights" from the pin menu. If you want them to not be exactly equal, you can edit that constraint to change the multiplier value to whatever you want.

Upvotes: 0

Related Questions