heyred
heyred

Reputation: 2051

How to auto layout between iPhone 4 and 5

I have an iPhone app that will only ever be in Portrait view.

I have a number of buttons etc. on my layout. However, when I switch between iPhone 4 and iPhone 5 sizes, I need the bottom image to "stick" to the bottom. The rest of the images and buttons can stay where they are. I just need to bottom white image to look like a footer.

Can anyone please tell me how to do this?

I have tried using constraint (Pin) and set the bottom margin value to 0 but this simply stretched the bottom white image across the entire View.

Below are 2 screen grabs of how the layouts appear for both iPhone 4 and 5 (this is taken in Storyboard) iPhone 4

enter image description here

And iPhone 5

enter image description here

Upvotes: 1

Views: 1767

Answers (1)

MatterGoal
MatterGoal

Reputation: 16430

You can just add a constraint to the bottom layout guide and set it to zero.

From your storyboard/xib, place the view at the bottom of the container, drag&drop from the view to the view itself but be sure to dragging downward. Then select "Bottom Space to Bottom Layout Guide". Now your view is fixed at this distance from the bottom of the main view.

You obviously have to set up the other constraints for the white view (width, height and horizontal position).

Upvotes: 3

Related Questions