Placeholder in UITextView

前端 未结 30 3187
野趣味
野趣味 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条回答
  •  甜味超标
    2020-11-22 16:15

    I made my own version of the subclass of 'UITextView'. I liked Sam Soffes's idea of using the notifications, but I didn't liked the drawRect: overwrite. Seems overkill to me. I think I made a very clean implementation.

    You can look at my subclass here. A demo project is also included.

提交回复
热议问题