UITextField输入到最大限值以后不能删除
2015-12-03 16:39
411 查看
转自:http://blog.csdn.net/linkai5696/article/details/5742421
解决UITextField输入到最大值不能删除的现象:
解决UITextField输入到最大值不能删除的现象:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { BOOL isAllowEdit = YES; if([string length]>range.length&&[textField.text length]+[string length]-range.length>_NAME_MAX_LENGTH_) { [textField resignFirstResponder]; isAllowEdit = NO; } return isAllowEdit; }
相关文章推荐
- 连接数据库超时设置autoReconnect=true
- [leetcode] 95. Unique Binary Search Trees II
- Android-Mac电脑如何进行APK反编译-使用apktool、jd-gui
- 去掉UISearchBar边框
- Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- easy-ui JOB 及 小记录
- 自定义Drawable(文字按钮点击效果设置)
- IOS上 关于状态栏的相关设置(UIStatusBar)
- iOS开发之键盘类型UIKeyboardType
- 招标系统-easyui插件中标签选择和创建
- UIGestureRecognizer手势
- easyui学习笔记
- cuda学习笔记——deviceQuery
- UITouch 触摸
- UITouch 触摸
- 63岁老人自学单片机 8年做出机器人—兄弟连IT教育
- UIGestureRecognizer手势
- UITableViewCell
- easyui-search搜索框
- UITableViewCell分割线顶边