簡體   English   中英

使用動畫更改UITextView文本顏色

[英]Change UITextView text color with animation

只是一個簡單的問題。 是否可以用動畫更改UITextView的文本顏色?

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

干杯!
- 馬丁

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

謝謝你的時間。
/馬丁

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM