Reputation: 1609
I have fiddled with the constraints for a while and for some reason on a view bigger than the view in the main storyboard looks awful. Right now it's on reset to suggested constraints. Those are my constraints below, I'm not sure what's going on. Is there something wrong with my Xcode or am I doing something wrong?
Upvotes: 0
Views: 1550
Reputation: 27620
The button stretches because you pinned it to the top and to the bottom. So on a larger screen the distance from the top and the bottom stays the same which means that the button is stretched.
Keeping the size of the button
The keep the size of the bottom an center is vertically und horizontally you have to give a width and a height constraint and a centerY and centerX constraint:
Keeping the aspect ratio of the button
EDIT: This is a cleaner solution suggested by Sega-Zero:
To scale the button according to the screen size but keep its aspect ratio you have to set an equal width constraint (with a multiplier) between button an its superview, an aspect ratio constraint and centerY and centerX constraints:
Upvotes: 1