UITextView Cursor Color not changing iOS 7
I was able to recreate your behavior: If I change the tint and text color while the text view isn't selected (aka: not first responder), everything will work as expected.
But if I first select it, by tapping it and than change the color by button press, they caret's (tint) color won't change.
Here is a workaround:
- (IBAction)changeColor:(id)sender
{
[_textView setTextColor:[UIColor greenColor]];
[_textView setTintColor:[UIColor greenColor]];
if([_textView isFirstResponder]){
[_textView resignFirstResponder];
[_textView becomeFirstResponder];
}
}
I'm using small hack in UITextViewDelegate method:
func textViewDidBeginEditing(_ textView: UITextView) {
let color = textView.tintColor
textView.tintColor = .clear
textView.tintColor = color
}
UPD
more technological way:
1) implement method in extension:
extension UITextView {
func resetTintColor(){
let color = tintColor
tintColor = .clear
tintColor = color
}
}
2) in an UITextViewDelegate implementation:
func textViewDidBeginEditing(_ textView: UITextView) {
textView.resetTintColor()
}
You can use
[_textView reloadInputViews];
And in Swift
textView. reloadInputViews()
Then you won't need to handle keyboard incoming and going.