Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 510
user1306926 Avatar asked Aug 11 '26 09:08

user1306926


1 Answers

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

like image 82
Mick MacCallum Avatar answered Aug 13 '26 03:08

Mick MacCallum