I am trying to write code for a button that will change the background color of text selected by a user in a UITextView.
This is how I implemented the Bold formatting button:
@IBAction func boldButton() {
textView.toggleBoldface(self)
}
But I don't know how to do something analogous for changing the background color of the selected text. Example code would be great! Thx!
You can set the
tintColorproperty of theUITextViewto accomplish this.