iOS UITextField addTarget和textFieldDidEndEditing之间的区别

时间:2018-10-26 15:12:46

标签: ios swift uitextfield

使用.editingDidEnd选项添加目标与方法textFieldDidEndEditing有什么区别?

@IBOutlet weak var textField: UITextField! {
    didSet {
        // check when textField editing ends
        textField.addTarget(self,
                            action: #selector(titleDidChange(_:)),
                            for: .editingDidEnd)
    }
}

VS。

func textFieldDidEndEditing(_ textField: UITextField) {
    // user has resigned responder
}

0 个答案:

没有答案