How to change height of text field?

前端 未结 4 736
终归单人心
终归单人心 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 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.

提交回复
热议问题