Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios/xcode: Set visible width of button

Tags:

xcode

width

ios

this should be simple but I am having trouble setting the width of textfields and/or buttons with placeholders in storyboard so that it looks right in the simulator..

I have set the width to 200. It looks find in storyboard, however, the textfield shrinks to the size of the placeholder when I build and run.

In the case of buttons, I also set the width to 200 but the button shrinks to the size of the label.

What am I not doing correctly?

like image 435
user1904273 Avatar asked Jun 29 '26 07:06

user1904273


1 Answers

Try setting width and height constraints of the textfield and button as displayed below:

enter image description here

Then click "Add 2 Constraints" (I know it says 3 in the image, ignore that).

like image 55
Leverin Avatar answered Jun 30 '26 21:06

Leverin