【发布时间】:2018-07-06 22:07:14
【问题描述】:
我正在尝试按顺序播放动画,但在播放它们时遇到问题,因为 for 循环遍历数组中的对象列表。
它会在数组中移动,但不会播放每一个,而是播放最后一个。
-(void) startGame {
gramma.animationDuration = 0.5;
// Repeat forever
gramma.animationRepeatCount = 1;
int r = arc4random() % 4;
[colorChoices addObject:[NSNumber numberWithInt:r]];
int anInt = [[colorChoices objectAtIndex:0] integerValue];
NSLog(@"%d", anInt);
for (int i = 0; i < colorChoices.count; i++) {
[self StrikeFrog:[[colorChoices objectAtIndex:i] integerValue]];
//NSLog(@"%d", [[colorChoices objectAtIndex:i] integerValue]);
sleep(1);
}
}
它在整个周期中移动得非常快,而 sleep 并没有做任何事情来让它播放每个动画......有什么建议吗?
【问题讨论】: