Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change UITextView text color with animation

Just a simple question. Is it possible to change the text color of UITextView with a animation?

[UITextView beginAnimations:nil context:NULL]; 
[UITextView setAnimationDuration:2.0]; 
     textView.textColor = [UIColor grayColor];  
[UITextView commitAnimations];   

Cheers!
- Martin

like image 477
f0rz Avatar asked Apr 29 '10 13:04

f0rz


2 Answers

Since iOS 4.0 you can now achieve this using [UIView transitionWithView:duration:options:animations:completion:]

[UIView transitionWithView:textView
                  duration:0.5f
                   options:UIViewAnimationOptionTransitionCrossDissolve
                animations:^{
                    textView.textColor = ...
                }
                completion:nil];
like image 59
James Avatar answered Sep 22 '22 07:09

James


The textColor is not an animatable property, so I don't think this will be feasible with the UITextView.

like image 45
Martin Cote Avatar answered Sep 22 '22 07:09

Martin Cote