Change UITextField and UITextView Cursor / Caret Color

前端 未结 16 2027
醉话见心
醉话见心 2020-12-07 09:33

I\'m wondering about changing the color of the cursor / caret in a UITextField (And UITextView if its the same answer) in iOS. I\'ve seen answers f

16条回答
  •  無奈伤痛
    2020-12-07 09:51

    Durgesh's approach does work.

    I also used such KVC solutions many times. Despite it seems to be undocumented, but it works. Frankly, you don't use any private methods here - only Key-Value Coding which is legal.

    P.S. Yesterday my new app appeared at AppStore without any problems with this approach. And it is not the first case when I use KVC in changing some read-only properties (like navigatonBar) or private ivars.

提交回复
热议问题