How to change height of text field?

40,971

Solution 1

Click the attribute inspector for the textField and then change the Border style to second one and you will be able to change the height.

enter image description here

Solution 2

Step 1 : Click the Attribute Inspector, Select the Border Styles which is not the rounded one.

borderstyle

Step 2 : Now go to Size Inspector and change the size of the TextField.

change the height of the textfield

Step 3 : Create an @IBOutlet for TextField and then add below code inside the viewWillAppear() or viewDidAppear().

userTextField.borderStyle = UITextBorderStyle.roundedRect

Swift 4.2

userTextField.borderStyle = UITextField.BorderStyle.roundedRect

Now you'll get the cool rounded textfield.

Solution 3

Change to square border style and then go back to rounded border and it will stay the same. This works for xCode 11.0

Solution 4

In the attribute inspector of your textField you can select the first, second and third Border Styles to increase the height.

Share:
40,971
4thSpace
Author by

4thSpace

Updated on November 22, 2020

Comments

  • 4thSpace
    4thSpace over 3 years

    Is there a way to change the height of a text field in IB?

    If not, what is the proper way to do it in code?

  • Eyad Shokry
    Eyad Shokry over 4 years
    doesn't work with me in xcode 10.2.1. the width and height are disabled
  • Vinoth Vino
    Vinoth Vino over 4 years
    Which border style you are using ?
  • Vinoth Vino
    Vinoth Vino over 4 years
    It's showing in Xcode 11 beta 4 with None, Line and Bezel border style.
  • Franva
    Franva about 2 years
    For XCode 12.4 the height and width in Size Inspector is disabled. I picked up the border style you mentioned. Could it be because of I put the TextField inside a Vertical StackView? How to fix this?