Change UITextField and UITextView Cursor / Caret Color

前端 未结 16 2038
醉话见心
醉话见心 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条回答
  •  Happy的楠姐
    2020-12-07 09:41

    Try, Its working for me.

    [[self.textField valueForKey:@"textInputTraits"] setValue:[UIColor redColor] strong textforKey:@"insertionPointColor"];
    

提交回复
热议问题