我正在尝试使用以下代码制作带有图片的动画:
NSMutableArray *imageArray = [[NSMutableArray alloc] initWithCapacity:22];
int i;
for (i =1; i < 22; i++) {
[imageArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"fbAnimation%d.png", i]]];
//make it animate
self.fbLogin.animationImages = [NSArray arrayWithArray:imageArray];
self.fbLogin.animationDuration =0.8;
self.fbLogin.animationRepeatCount = 5;
[self.fbLogin startAnimating];
}
int j;
NSMutableArray *imageLoading = [[NSMutableArray alloc] initWithCapacity:4];
for (j = 1; j < 4; j++) {
[imageLoading addObject:[UIImage imageNamed:[NSString stringWithFormat:@"loading%d.png", j]]];
//make it animate
self.fbLogin.animationImages = [NSArray arrayWithArray:imageLoading];
self.fbLogin.animationDuration = 1;
self.fbLogin.animationRepeatCount = 5;
[self.fbLogin startAnimating];
}
}
问题是,到目前为止,无论哪种方式我都尝试过,只有一个动画会在屏幕上执行。我希望运行第一个动画,然后运行第二个“正在加载...”,直到来自 facebook 的所有其他数据都准备好。