저는 이미지 애니메이션을 만들고 싶습니다. 이제는 이미지 이름을 설정하고 싶지만 ... png 형식의 이미지가 50 개 있습니다. 동일한 이미지 이름을 검색합니다. {iPhone SDK}
내 이미지 이름
은 다음과 같습니다iamge_0000 to image_0050
pasheAnimation.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"pashe_0000.png"],nil];
[pasheAnimation setAnimationRepeatCount:5];
pasheAnimation.animationDuration = 4;
[pasheAnimation startAnimating];
?!?!?!?
제이슨 코드 [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];
실제로 이미지 이름을 나타내려면 문자열 형식을 변경해야합니다. 따라서 이미지의 이름이 pashe_0000.png 인 경우 문자열 형식은 pashe_ % 04d.png이어야합니다. 매우 중요합니다. 또한 실제로 608 개의 이미지가 있습니까? –
제이슨, 내 파일 이름을 변경하고 p607로 변경했습니다. 내 응용 프로그램이 다시 충돌합니다 .. 그게 저를 미치게합니다 !!!! : @ 예 짧은 애니메이션 PLZ입니다. – Momi
다시 코드를 편집합니다. 보세요 – Momi