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?
Constrains
Click the label
Don't set any heights
Now set top space to the container view
Centre horizontal to container view
Now set the height (or) bottom space to the smiley
Add this all constraints you will get what you expected.
just use this code :
yourLabel.translatesAutoresizingMaskIntoConstraints = YES;
CGPoint centerPoint = yourLabel.center;
centerPoint.x = yourImageView.center.x;
yourLabel.center = centerPoint;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.