tingxins / InputKit

📝InputKit, an Elegant Kit to limits your input text, inspired by BlocksKit, written in both Objective-C & ⚡️Swift.

Home Page:https://tingxins.com/2017/06/input-kit-introduction/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于 delegate 的问题

gofinal opened this issue · comments

swift 4.0 使用 LimitedTextField时 添加delegate 无效

@available(iOS 2.0, *)
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
    var flag = true
    if let realDelegate = self.realDelegate, realDelegate.responds(to: #selector(textFieldShouldReturn(_:))) {
        flag = realDelegate.textFieldShouldReturn(textField)
    }
    return flag
}// called when 'return' key pressed. return NO to ignore.

最后这几行代码 你copy丢了 改成这样就好了...