UITextView占位符
2016-12-15 本文已影响7人
哎呦我去叫什么呢
self.textView.delegate = self;
//开始编辑
- (void)textViewDidBeginEditing:(UITextView *)textView {
if ([self.textView.text isEqualToString:@""]) {
textView.text = @"";
self.textView.textColor = [UIColor blackColor];
}
}
//在结束编辑的代理方法中进行如下操作 - (void)textViewDidEndEditing:(UITextView *)textView {
if (textView.text.length<1) {
self.textView.text = @"";
self.textView.textColor = colorText;
}
}