Enable a button in Swift only if all text fields have been filled out

前端 未结 10 760
误落风尘
误落风尘 2020-12-01 01:20

I am having trouble figuring out how to change my code to make it so the Done button in the navigation bar is enabled when my three text fields are filled out.

I cur

10条回答
  •  情歌与酒
    2020-12-01 01:35

    This works for me: Hope it helps

      func textFieldDidEndEditing(textField: UITextField) {
            if txtField1.hasText() && textField2.hasText() && textField3.hasText(){
                doneBarButton.enabled = true
            }
        }
    

提交回复
热议问题