Reputation: 11416
I a beginner in iOS programming.
I was following a tutorial, and I had to create TextField as shown in the picture below. what I am trying to do is, to force the width of the TextField to expand when the screen in in Landscape mode. In the tutorial I am following, this step is explained and according to the that tutorial I have to press ctrl and drag the TextField vertically to invoke the AutoLayout engine, I did that but when I rotate the simulator the width doesn't grow.
image vertically:
image horizontally
Upvotes: 1
Views: 359
Reputation: 8106
Set the Leading
and Trailing
space of your UITextField
to your view
. See screenshot below:
You also need to set the vertical constraints (Top/Bottom/Height) otherwise you will receive an error. From my example I set the Top
spacing and Height
since UITextField usually have constant heights.
Upvotes: 1
Reputation: 14040
for the horizontal layout you have to...
and - if you didn't already do that - you also have to ctrl drag from the textfield to the top of it and add a top constraint (to the top layout guide for example) to set its vertical position
Upvotes: 1