HELLO
HELLO

Reputation: 497

Coding various X/Y coordinates for different devices with Auto Layout

I'm using a UIImageView for all iPhones with 40H,40W size. If I put this UIImageView in the middle of iPhone 4s storyboard, the x-coordinate=140. If I put this UIImageView in middle of iPhone 6PLUS storyboard x-coordinate=187

If i'm using auto layout with a single storyboard and a single ViewController class for all devices, yet both differently sized phones have different center coordinates, how do I code for UIImageView to be centered for both phones in the same ViewController class?

Upvotes: 0

Views: 151

Answers (1)

Paul.s
Paul.s

Reputation: 38728

Just add constraints to center vertically and horizontally

enter image description here

Upvotes: 0

Related Questions