3

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?

user1904273
  • 4,058
  • 11
  • 37
  • 82

1 Answers1

5

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).

Leverin
  • 729
  • 7
  • 24
  • That worked. However, is it true that you must use constraints for this and the attributes inspector is of no help? Seems like I am going to need an awful lot of constraints i.e. several for every design element. – user1904273 May 18 '15 at 20:09
  • The attributes inspector should be sufficient for what you'd like to do. Check out this answer: http://stackoverflow.com/a/26482088/2919327 – Leverin May 19 '15 at 21:39