toastRect
结束,并且它没有之后继续前进。在进入下一个动画之前,如何强制代码完成每个动画?
int i;
for (i=0; i < 100; i++) {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:9];
toast.view.frame = toastRect1;
[UIView commitAnimations];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:9];
toast.view.frame = toastRect2;
[UIView commitAnimations];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:9];
toast.view.frame = toastRect;
[UIView commitAnimations];
NSLog(@"%d",i);
}
}
答案 0 :(得分:3)
我认为您需要使用+ (void)setAnimationDidStopSelector:(SEL)selector
。如果需要,请仔细查看http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/uiview/uiview.html。
答案 1 :(得分:1)
您可以使用setAnimationDidStopSelector
方法链接动画。查看文档以获取详细信息:http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/uiview/uiview.html%23//apple_ref/occ/clm/UIView/setAnimationDidStopSelector: