Swift 4 Centering Layouts Between iPhone and iPad

75 views Asked by At

I'm new to iOS development and Swift (4), and I'm trying to figure out how to manage layouts for both the iPhone and iPad. I want to center all three components vertically and horizontally on both displays, but when I use the Attributes Inspector for the elements and select the centering I want it does not look correct.

This is what I'm seeing on both displays

iPad

enter image description here

iPhone

enter image description here

Can someone help me figure out what newbie mistake I'm making?

Thanks for your time.

1

There are 1 answers

0
Shehata Gamal On BEST ANSWER

You need to use auto-layout for that just select the middle item and ctrl-drag to the parent view then select center horizontally and vertically from the popup after that hook the bottom of the top item to that centered item and the top of the bottom most item to that centered item also