Is there a way to change the foregroundColor of a UIView?
I'm creating an arrow using an UIView (drawRect) like this ">", with a clear background, only two black lines. This is working great. But afterwards I would like to change the color of the ">" from black to red, for example. Would be nice to have an animation in it, like a gradient from black to red, using CAKeyframeAnimation. I can do it for borderColor and backgroundColor but these properties are not the ones that I'm looking for.
I'm changing the borderColor of another UIView using this block of animation. I would like to do the same with the foregroundColor but it's not working in iOS.
CAKeyframeAnimation* colorAnim = [CAKeyframeAnimation animationWithKeyPath:@"borderColor"];
NSArray* colorValues = [NSArray arrayWithObjects:(id)[UIColor blackColor].CGColor,(id)[UIColor redColor].CGColor, nil];
colorAnim.values = colorValues;
colorAnim.calculationMode = kCAAnimationPaced;
colorAnim.duration = 5.0;
colorAnim.repeatCount = 1;
[self.myView.layer addAnimation:colorAnim forKey:@"borderColor"];
I appreciate any help, thanks!