views:

283

answers:

1

I have two animation sequences, and I want one of them to play randomly when a button is pressed. Here is the code:

{

    color.animationImages = [NSArray arrayWithObjects:
                        [UIImage imageName: @"1.gif"],
                        [UIImage imageName: @"2.gif"],
                        [UIImage imageName: @"3.gif"],
                        [UIImage imageName: @"4.gif"],
                        [UIImage imageName: @"5.gif"],
                        [UIImage imageName: @"6.gif"],
                        [UIImage imageName: @"7.gif"], nil];
    [color setAnimationRepeatCount:0];
    color.animationDuration = 3;
    [color startAnimation];

}

I don't know how to do the code for this. So if anyone knows please tell me! Thank you!

A: 

I think the problem is with your images. Do you have the set of images in one .gif file. If yes then please save all these seven images explicitly with .png or any other image format. Then your code will work.

Madhup