I have a button which I would like to animate the background color as if it is filling from the bottom to the top.
Right now I'm just changing the color with animation
i.e
[UIView animateWithDuration:2.0 animations:^{
button.layer.backgroundColor = [UIColor redColor].CGColor;
} completion:NULL];
This works just fine but I'd love the animation to fill from the bottom up like it is filling up with liquid.
EDIT: not sure if it makes a difference but the button is round
If you need just background color filling from bottom to top, you could create additional layer with that color and origin Y = CGRectGetHeight(button.frame). When you need to fill your button just animate origin Y of that layer to 0.
Swift
version of Avi answer.Try this. Here btn is the outlet to your button and v is the view we will be adding to your button for animation purpose.