开发者

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!

- Martin


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];


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜