Reputation: 105
Hello people can anyone help us in how to change the cursor blink color of UITextView in Xcode using Swift language or from storyboard.
Upvotes: 8
Views: 5567
Reputation: 125
For some reason that I don't know, I had to run a didChange
method because tintColor
on its own doesn't work.
BTW, I'm on Swift 5.
textView.tintColor = .white
textView.tintColorDidChange()
It works for me!
Upvotes: 9
Reputation: 389
This works fine and looks better then double assign
DispatchQueue.main.async {
self.addressTextView.tintColor = UIColor.yourColor
}
Upvotes: 0
Reputation: 887
Just assign the tint color twice.
textView.tintColor = UIColor.black
textView.tintColor = UIColor.white
Upvotes: 0
Reputation: 4156
I tried setting the tintColor of textView and textField in storyboard. TextField cursor changed color, but textView didn't.
It helped me next:
let redTintColor: UIColor = UIColor.red
override func awakeFromNib() {
super.awakeFromNib()
textView.tintColor = redTintColor
}
or
let redTintColor: UIColor = UIColor.red
override func awakeFromNib() {
super.awakeFromNib()
textView.tintColor = redTintColor
textView.tintColorDidChange()
}
Upvotes: 1
Reputation: 553
Swift 4, Xcode 9.1 Beta
I tried setting the tintColor of my UITextView in the interface builder but that didn't work for me. I don't know why, but setting the tintColor on my UITextView to one color, then resetting it to the color I really wanted worked for me...
myUITextView.tintColor = .anySystemColor
myUITextView.tintColor = .theColorYouReallyWant
Upvotes: 7
Reputation: 1360
To do it in storyboard, do this
Set the Tint
to your desired color.
Upvotes: 1
Reputation: 6067
just change Tint Color
UITextView.appearance().tintColor = .black
Objective-C:
[[UITextView appearance] setTintColor:[UIColor blackColor]];
Upvotes: 3