iIImageView.animationImages를 사용하여 iOS 앱에서 애니메이션을 만들기 위해 UIImage 객체 배열을 아래에 나열된 메서드에 전달하여 애니메이션을 많이 만듭니다. 현재 내 UIImage 객체 배열에는 별도의 PNG 파일이 들어 있습니다. 나는 별도의 PNG 파일의 배열을 전달하는 대신 Sprite Sheet를 전달하여 &을 사용하여 유사한 애니메이션을 수행 할 수 있음을 알고 있습니다. 다른 스프레드 시트의 장점은 다른 목적을위한 것입니까?Sprit Sheets 애니메이션 용 PNG 파일의 배열
- (void) startImageViewAnimation:(UIImageView *)imageView WithImages:(NSArray*)imageArray orBuildArrayWithImage:(NSString *)imageName duration:(CGFloat)duration repeatCount:(NSInteger)repeatCount soundFile:(NSString *)soundFile stopSoundAfterDuration:(CGFloat) stopSoundDuration
{
if([imageName length] != 0)
{
NSMutableArray *array = [[NSMutableArray alloc] init];
UIImage *image;
int index = 1;
NSString *string;
do
{
string = [NSString stringWithFormat:@"%@%02d.png", imageName, index++];
image = [UIImage imageNamed:string];
if(image)
[array addObject:image];
} while (image != nil);
imageView.animationImages = array;
[array release];
}
else
{
imageView.animationImages = imageArray;
}
imageView.animationDuration = duration;
imageView.animationRepeatCount = repeatCount;
[imageView startAnimating];
if([soundFile length] != 0)
{
[self loadSoundEffectAudio:soundFile];
}
}