[英]Change the color of UIView Object Reference while it is animating
我在xib文件中繪制了一個視圖。 我希望它在動畫時更改其顏色。 動畫正在工作。 但是我找不到改變對象的顏色。 請幫我解決一下這個。 我對ios完全陌生。 提前感謝。
在您的UIView
動畫過程中編寫以下代碼。
YourView.backgroundColor = [UIColor redColor];
嘗試這個。
[UIView animateWithDuration:2.0 animations:^ {
//other animations
self.view.backgroundColor = [UIColor redColor];
}
completion:nil];
我認為您不能像使用animateWithDuration ...那樣對顏色進行動畫處理。 您將必須使用計時器並遍歷一系列顏色。 例如,您可以使用colorWithHue:saturation:brightness:alpha:並增加色相值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.