Animation on button using images
I have a UIButton which has arrow kind of blue image set as
UIImage *arrowImage = [UIImage imageNamed:@"bluearrow.png"]; [self.prevbutton setBackgroundImage:arrowImage forState:UIControlStateNormal];
Now I have another image yellow.png, that I want to super impose on top of this button image and make a flashing animation continuously. How can I do this?
This should help you.
myButton.imageView.animationImages = [NSArray arrayWithObjects:[UIImage imageNamed:@"image1.png"], [UIImage imageNamed:@"image2.png"], nil]; myButton.imageView.animationDuration = 0.5; //whatever you want (in seconds) [myButton.imageView startAnimating];
As quoted from https://stackoverflow.com/a/7490535/716216