Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to center a label horizontally for all iOS devices in Swift

I can't figure out how to make the label horizontally center in a image view, The label says "You've been here. What would you rate us, I want the What would you rate us to be under the "You've been here." What I attempted to do accomplish this was to add 2 lines to the labels and select the label plus the 3 buttons and clicked on "Add Missing Constrains". When I run the program this is the result.

How can I fix it so the text is entered on all devices?

enter image description here

Constrains

enter image description here

like image 637
Katz Avatar asked Dec 24 '15 06:12

Katz


1 Answers

for your label try to add constraints like:

Add top, width and height constraints as shown in below screen shot and make sure that constraints to margins is uncheck.

enter image description here

And set horizontal center constraints.

enter image description here

like image 165
Mehul Sojitra Avatar answered Nov 04 '22 09:11

Mehul Sojitra