一个简单的问题。 是否可以使用动画更改UITextView的文本颜色?
[UITextView beginAnimations:nil context:NULL];
[UITextView setAnimationDuration:2.0];
textView.textColor = [UIColor grayColor];
[UITextView commitAnimations];
干杯!
- Martin
一个简单的问题。 是否可以使用动画更改UITextView的文本颜色?
[UITextView beginAnimations:nil context:NULL];
[UITextView setAnimationDuration:2.0];
textView.textColor = [UIColor grayColor];
[UITextView commitAnimations];
干杯!
- Martin
自从 iOS 4.0 版本以后,你可以使用 [UIView transitionWithView:duration:options:animations:completion:]
来实现这一点。
[UIView transitionWithView:textView
duration:0.5f
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
textView.textColor = ...
}
completion:nil];
textColor不是可动画的属性,因此我认为在UITextView中实现这一点是不可行的。
正如Martin Cote所说,textColor属性不支持动画处理。
为了解决这个问题,我改变了UITextView的透明度。
[UITextView beginAnimations:nil context:NULL];
[UITextView setAnimationDuration:2.0];
textView.alpha = 0.5f;
[UITextView commitAnimations];