I have a UITextView where the user can input text. Say the user has already inputted a value. How can I change the font color of that already typed text and future typed text to a different one with the click of a button?
I already have it set up where I can change the color of the text but it only works if I choose a color BEFORE I start typing. After I start typing and I attempt to change the color, it doesn’t do anything.
I have this:
-(IBAction)changeInkColor:(id)sender
{
[inkTextField setTextColor:[UIColor greenColor]];
inkTextField.text=@"text";
}
and that actually works and displays “text” in green only if there is no text already in the view. However if I type something in and then hit this button, nothing happens.
I just tried that and I had no problems. I set up a button that called
[myTextView setTextColor:[UIColor redColor]];After typing a bit with black text color, I pressed the button, and everything turned red. Then I continued typing, all in red.
Are you using
setTextColor:to do this also?