English 中文(简体)
iPhone SDK: Two animation sequences playing at random *help*
原标题:

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!

问题回答

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.





相关问题
Weighted random numbers

I m trying to implement a weighted random numbers. I m currently just banging my head against the wall and cannot figure this out. In my project (Hold em hand-ranges, subjective all-in equity ...

Comprehensive information about hash salts

There are a lot of questions about salts and best practices, however most of them simply answer very specific questions about them. I have several questions which feed into one another. Assuming a ...

Generate unique names?

I am working on a php site in which we have to upload images from users.i have to rename that file for preventing conflicts in the name of the image. uniqid(rand(), true); and adding a large random ...

How to get two random records with Django

How do I get two distinct random records using Django? I ve seen questions about how to get one but I need to get two random records and they must differ.

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

热门标签