user1306926
user1306926

Reputation: 145

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?

Upvotes: 3

Views: 1388

Answers (1)

Mick MacCallum
Mick MacCallum

Reputation: 130222

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

Upvotes: 4

Related Questions