I have an array of UILabels that I want to animate across the screen. I am iterating though the array using a for loop like below:
for(int i=0; i<[self.onScreenLabels count]; i++)
{
UILabel *label = self.onScreenLabels[i];
int x = label.frame.origin.x;
int y = label.frame.origin.y;
label.center=CGPointMake(320, 0);
[self.view addSubview:label];
[UIView animateWithDuration:0.3 delay:1.0 options:0 animations:^{
label.center=CGPointMake(x, y);
} completion:^(BOOL finished){
}];
}
I want each UILabel to delay 1.0 second after the last before animating, e.g. wait 1 second, fire the first, wait 1 second fire the second, wait 1 second fire the third ....etc all the way to the end of the array. However using this code there is a 1 second delay but ALL the labels then animate at the same time. Why is this? Is there a way around it?
thanks