I have the following animation block:
[UIView animateWithDuration:3.0 animations:^{
NSLog(@"INDEX %d", index);
[self.visibleViewControllers_ enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
UIViewController *viewController = (UIViewController *)obj;
if (viewController.view.tag != index){
if (viewController.view.tag < index){
NSLog(@"LOWER VIEW WITH TAG %d", viewController.view.tag);
[viewController.view setFrameY:self.contentOffset.y - viewController.view.frameHeight];
} else if (viewController.view.tag > index){
NSLog(@"UPPER VIEW WITH TAG %d", viewController.view.tag);
[viewController.view setFrameY:600];
} else {
[viewController.view setFrame:CGRectMake(0, self.contentOffset.y, selectedView.frameWidth, 460)];
}
}
}];
//[selectedView setFrame:CGRectMake(0, self.contentOffset.y, selectedView.frameWidth, 460)];
}completion:^(BOOL finished){
[self.visibleViewControllers_ enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
UIViewController *viewController = (UIViewController *)obj;
NSLog(@"VIEW CONTROLLER Y IS %f AT INDEX %d", viewController.view.frameY, viewController.view.tag);
}];
}];
Basically it’s a dictionary of view controllers that it’s view I want to animate, but what’s weird is that it only performs one animation. Not all. Why is this? Is it possible to do enumeration inside an animation block?
enumerate your views and animate them in your enumeration
you did one animation and enumerate all view in this animation. just turn it around