- ( void ) viewDidLoad {//...comments . text = @"请输入:" ;comments . textColor = [ UIColor lightGrayColor ];isEmpty = YES ;//...}
- ( BOOL ) textViewShouldBeginEditing: ( UITextView * ) textView {if ( isEmpty ) {comments . text = @"" ;comments . textColor = [ UIColor blackColor ];isEmpty = NO ;}return YES ;}
- ( void ) textViewDidEndEditing: ( UITextView * ) textView {if ( comments . text . length == 0 ){comments . textColor = [ UIColor lightGrayColor ];comments . text = @"请输入:" ;isEmpty = YES ;}}注意:需要在.h文件种添加协议< UITextViewDelegate>,在.m文件种设置协议 comments.delegate=self;
详细解决方案
带提示(hint)的多行文本输入--UITextView
热度:68 发布时间:2024-01-11 11:09:42.0
相关解决方案
- 【转】关于UILabel UITextView UIWebView 行间距 文字排字
- 为啥子uitextview的frame 输出 <UITextView: 0x91a4e00; frame = (0 0; 0 0)
- UITextView 怎么追加文字
- android:hint 在Android平板上不显示解决办法
- Oracle优化全攻略2(Oracle SQL Hint 11g)
- Oracle优化全攻略1(Oracle SQL Hint)
- HINT 不生效?
- Full Hint
- IOS UITextView 和 UITextField 联想输入法字数限制
- index_ss hint 使用的执行计划变化对比
- Mysql Hint
- [微信开发]invalid credential, access_token is invalid or not latest hint
- 带提示(hint)的多行文本输入--UITextView
- ISO UITextView 做意见反馈
- android 在布局文件中报错:This text field does not specify an inputType or a hint
- ORACLE进阶之一:HINT
- ios UITextView 添加链接 垂直居中和水平居中