Je veux créer une animation d'image, j'ai 50 images avec le format png maintenant je veux définir le nom des images ... quelque chose comme ça, mais ne marche pas!Détecter le même nom d'images {iPhone SDK}
mon nom d'images sont: iamge_0000 to image_0050
pasheAnimation.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"pashe_0000.png"],nil];
[pasheAnimation setAnimationRepeatCount:5];
pasheAnimation.animationDuration = 4;
[pasheAnimation startAnimating];
??!?!?
code jason [edited]:
NSMutableArray* myImages = [[[NSMutableArray alloc] initWithCapacity:607] autorelease];
for(int i = 1; i <= 607; i++) {
[myImages addObject:[UIImage imageNamed:[NSString stringWithFormat:@"p%d.png",i]]];
}
butterflyView.animationImages = myImages;
[butterflyView setAnimationRepeatCount:100];
butterflyView.animationDuration = 0;
[butterflyView startAnimating];
Vous devez modifier le format de chaîne pour représenter réellement le nom de votre image. Donc, si votre image s'appelle pashe_0000.png, votre format de chaîne doit être pashe_% 04d.png - c'est très important. Aussi, avez-vous vraiment 608 images? –
Jason, j'ai changé mes noms de fichiers et les ai changés en p1 à p607 mon accident de l'application à nouveau .. qui me rend fou !!!! : @ ouais c'est animation courte PLZ aide moi – Momi
je édite mon code à nouveau. Jetez un oeil – Momi