How to change height of text field?

前端 未结 4 735
终归单人心
终归单人心 2021-02-02 08:28

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?

相关标签:
4条回答
  • 2021-02-02 08:56

    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.

    0 讨论(0)
  • 2021-02-02 09:05

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

    0 讨论(0)
  • 2021-02-02 09:06

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

    Step 2 : Now go to Size Inspector and change the size 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.

    0 讨论(0)
  • 2021-02-02 09:10

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

    0 讨论(0)
提交回复
热议问题