MSVTextFieldPod
示例
要运行示例项目,克隆仓库,并首先从示例目录运行 pod install
。
简单任务:如何使 UITextfield 在点击时高亮显示?(即获得焦点)
simpleTextField.onFocus { textField, isBegin in
textField.backgroundColor = isBegin ? UIColor.yellow : UIColor.lightGray
}
如何检查输入并高亮显示?
simpleTextField.onFocus { textField, isBegin in
textField.backgroundColor = isBegin ? UIColor.yellow : UIColor.lightGray
}.onChange { _, string in
return string.count < 10 // check for 10 symbols max
}
需求
安装
MSVTextFieldPod 通过 CocoaPods 提供。要安装它,请简单地在 Podfile 中添加以下行:
pod 'MSVTextFieldPod'
作者
Serge Moskalenko,https://github.com/sergemoskalenko
许可协议
MSVTextFieldPod遵循MIT许可协议。详细信息请参见LICENSE文件。