我正在尝试为 UIToolbar 的 tintColor 属性设置动画,以将其从一种 tintColor 更改为另一种。
这是我正在尝试的代码。不幸的是,这种变化会立即发生并且不会从绿色变为蓝色。这很奇怪,因为我知道 Apple 在网络共享或打电话时会褪色并“脉冲”工具栏色调。那为什么这行不通呢?
// set initial tint color
myBottomToolBar.tintColor = [UIColor colorWithRed:0.15 green:0.95 blue:0.15 alpha:0.6];
//animation stuff
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.95];
[UIView setAnimationDelegate:self];
//thing to animate
myBottomToolBar.tintColor = [UIColor colorWithRed:0.15 green:0.35 blue:0.45 alpha:0.6];
//animation stuff
[UIView commitAnimations];
最佳答案
色调颜色不可通过公共(public) API 设置动画。您可以通过手动更改计时器上的色调来解决此问题。您将不得不插入中间颜色级别。
关于iphone - 我可以淡化/动画 UIToolbar 的 tintColor 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4495101/