Malik Türk
Malik Türk

Reputation: 105

How To Change UITextView Cursor Blink Color in Xcode

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

Answers (7)

unferna
unferna

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

Ivan Titkov
Ivan Titkov

Reputation: 389

This works fine and looks better then double assign

DispatchQueue.main.async {
    self.addressTextView.tintColor = UIColor.yourColor
}

Upvotes: 0

ayalcin
ayalcin

Reputation: 887

Just assign the tint color twice.

textView.tintColor = UIColor.black
textView.tintColor = UIColor.white

Upvotes: 0

maxwell
maxwell

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

Bikeboy
Bikeboy

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

iPeter
iPeter

Reputation: 1360

To do it in storyboard, do this

enter image description here

Set the Tint to your desired color.

Upvotes: 1

Abdelahad Darwish
Abdelahad Darwish

Reputation: 6067

just change Tint Color

UITextView.appearance().tintColor = .black 

Objective-C:

[[UITextView appearance] setTintColor:[UIColor blackColor]];

Upvotes: 3

Related Questions