textView 的一些方法
/**
* 用来限定textView的输入字数
*
* @param textView <#textView description#>
*/
- (void)textViewDidChange:(UITextView*)textView
{
if (textView.text.length > kMaxTextLength) {
textView.text = [textView.text substringToIndex:kMaxTextLength];
}
}
/**
* 清除假placeHolder文字
*
* @param textView <#textView description#>
*/
- (void)textViewDidBeginEditing:(UITextView*)textView
{
if ([textView.text isEqualToString:@"请输入备注,最多140字.."]) {
textView.text = @"";
textView.textColor = [UIColor blackColor];
}
}
/**
* 添加假placeHolder文字
*
* @param textView <#textView description#>
*/
- (void)textViewDidEndEditing:(UITextView*)textView
{
if ([textView.text isEqualToString:@""]) {
textView.text = @"请输入备注,最多140字..";
textView.textColor = [UIColor lightGrayColor];
}
}