关于textView上显示placeholder

首先写一个Lable然后设置其初始状态,然后在textView的代理方法中进行判断

- (void)textViewDidChange:(UITextView *)textView{

    if (textView.text.length == 0) {

        _placholderLabel.hidden = NO;

    } else {

        _placholderLabel.hidden = YES;

    }

    [_textView scrollRectToVisible:CGRectMake(0, _textView.contentSize.height+80, _textView.contentSize.width, 20) animated:NO];


}


你可能感兴趣的:(关于textView上显示placeholder)