美文网首页
uitextview 实现placeholder

uitextview 实现placeholder

作者: wodeph | 来源:发表于2023-04-26 11:42 被阅读0次

textView.text=@"Placeholder";

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

 if([textView.text isEqualToString:HDLocalizedString(@"Placeholder")]) {

                textView.text=@"";

                textView.textColor= [UIColorblackColor];

    }

}

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

 if(textView.text.length<1) {

            textView.text = HDLocalizedString(@"Placeholder");

            textView.textColor= [UIColorlightGrayColor];

   }

}

相关文章

网友评论

      本文标题:uitextview 实现placeholder

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