Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有几个 UITextfield 问题。
有没有办法强制清除文本字段的“x”在用户不关注文本字段时不隐藏?
还有一种方法可以检测透明板上的触摸吗?didClearTextField 什么的?
谢谢!
1.设置clearButtonMode为UITextFieldViewModeAlways
clearButtonMode
UITextFieldViewModeAlways
2.实现delegate方法textFieldShouldClear:。或者textField:shouldChangeCharactersInRange:replacementString:分析编辑。
delegate
textFieldShouldClear:
textField:shouldChangeCharactersInRange:replacementString: