Placeholder in UITextView

前端 未结 30 3074
野趣味
野趣味 2020-11-22 16:01

My application uses an UITextView. Now I want the UITextView to have a placeholder similar to the one you can set for an UITextField.<

30条回答
  •  -上瘾入骨i
    2020-11-22 16:09

    Take a look at UTPlaceholderTextView.

    This is a convenient subclass of UITextView that supports placeholder similiar to that of UITextField. Main peculiarities:

    • Does not use subviews
    • Does not override drawRect:
    • Placeholder could be of arbitrary length, and rendered just the same way as usual text

提交回复
热议问题