- ( 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的全部内容,更多相关带提示(hint)内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复