UITextView的字数限制 及 添加自定义PlaceHolder
2015-11-25 11:44
465 查看
- (void)textViewDidChange:(UITextView *)textView{ NSString *temp=textView.text; //字数超过限制数量时,进行截取替换 if([[textView text] length] > _limitCharactorNumbers){ textView.text=[temp substringToIndex:_limitCharactorNumbers]; } //显示剩余字数 _leftNumberLabel.text = [NSString stringWithFormat:@"%u",(_limitCharactorNumbers - textView.text.length)]; // placeHolder实现方法: 自己添加一个UILabel在UITextView左上角 if (textView.text.length == 0) { _placeHolderLabel.text = _placeHolder; }else{ _placeHolderLabel.text = @""; } }
相关文章推荐
- 为什么要使用ToStringBuilder
- 10分钟精通require.js
- UESTC 1218 Pick The Sticks (dp )
- UIView 翻转动画
- bluetooth handfree client test on console
- UIButton 点击后变灰
- TinyOS论文03:Bugs or Anomalies? Sequence Mining based Debugging in Wireless Sensor Networks
- Fluent API 配置
- UITextView - 3
- [转]Ionic – Mobile UI Framework for PhoneGap/Cordova Developers
- AS2.0--加速你的开发build速度
- libubox - uloop runqueue ustream
- 用Pymel里的with来些UI
- ElasticsSearch——Query String
- UIBarButtonSystemItem样式
- 更换免开发证书账号出现的Your build settings specify a provisioning profile with the UUID"",however,no such provisioning profile was found
- vue.js学习笔记
- 2.AsyncQueryHandler、内容提供者
- R12.2.0 buildStage 运行结果
- Bringing up interface eth0: Error: No suitable device found: no device found for connection 'System