我试图给UITextField边框颜色设置动画(淡入)。这是我尝试的UITextField边框动画
tmp.layer.borderColor= [UIColor colorWithRed:255.0 green:0.0 blue:0.0 alpha:0.0].CGColor;
tmp.layer.borderWidth = 1.0f;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2];
tmp.layer.borderColor= [UIColor colorWithRed:255.0 green:0.0 blue:0.0 alpha:1.0].CGColor;
[UIView commitAnimations];
上面的代码将红色边框添加到textFields,但没有动画。
请参阅更新的代码。 Alpha通道仍然不动画。 – foho 2012-03-07 12:19:42
不,请设置不带alpha的颜色。我的意思是视图本身的alpha属性应该是动画的。像'tmp.alpha = 0.0;'在创建阶段,'tmp.alpha = 1.0;'在动画块内部。 – Ariel 2012-03-07 12:27:44
我无法得到它。你能告诉我一个例子吗? – foho 2012-03-07 12:33:21