美文网首页
UITextView占位符

UITextView占位符

作者: 哎呦我去叫什么呢 | 来源:发表于2016-12-15 12:51 被阅读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;
    }
    }

相关文章

网友评论

      本文标题:UITextView占位符

      本文链接:https://www.haomeiwen.com/subject/tjtgmttx.html