Change UITextView text color with animation
Just a simple question. Is it possible to change the text color o开发者_如何学Gof UITextView with a animation?
[UITextView beginAnimations:nil context:NULL];
[UITextView setAnimationDuration:2.0];
textView.textColor = [UIColor grayColor];
[UITextView commitAnimations];
Cheers!
- MartinSince 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];
The textColor is not an animatable property, so I don't think this will be feasible with the UITextView.
As Martin Cote said textColor is not an animatable property.
I solved this with a change to the UItextView transparency instead.
[UITextView beginAnimations:nil context:NULL];
[UITextView setAnimationDuration:2.0];
textView.alpha = 0.5f;
[UITextView commitAnimations];
Thanks for your time.
/ martin
精彩评论