Implementing UITextFieldDelegate with Swift

前端 未结 12 1240
后悔当初
后悔当初 2020-12-08 08:11

I have my ViewController class which implements UITextFieldDelegate. I have no auto complete for the funcs such as textFieldShouldBeginEditing. Is this a bug in XCode 6?

12条回答
  •  伪装坚强ぢ
    2020-12-08 09:01

    Swift 3.0.1
    
     // UITextField Delegates
        func textFieldDidBeginEditing(_ textField: UITextField) {
        }
        func textFieldDidEndEditing(_ textField: UITextField) {
        }
        func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
            return true;
        }
        func textFieldShouldClear(_ textField: UITextField) -> Bool {
            return true;
        }
        func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
            return true;
        }
        func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
            return true;
        }
        func textFieldShouldReturn(_ textField: UITextField) -> Bool {
            textField.resignFirstResponder();
            return true;
        }
    

提交回复
热议问题