让我让自己清楚。我正在使用一系列由用户操作触发的动画。如何使用performSelector:afterDelay:做动画之后?
只有当我做一个performSelector:afterDelay:它不起作用,如果完成后的动画。
我不知道这个答案会为我的工作,如果我是做OS X的发展,但也可能是一个线索:https://stackoverflow.com/a/1078216/676822
谁能帮助我? 感谢
让我让自己清楚。我正在使用一系列由用户操作触发的动画。如何使用performSelector:afterDelay:做动画之后?
只有当我做一个performSelector:afterDelay:它不起作用,如果完成后的动画。
我不知道这个答案会为我的工作,如果我是做OS X的发展,但也可能是一个线索:https://stackoverflow.com/a/1078216/676822
谁能帮助我? 感谢
从我可以收集的内容中,您尝试执行一系列动画,每个动画在开始之前都有一段延迟。因此,而不是使用performSelector:afterDelay:
调用动画,可以嵌套调用animateWithDuration:delay:options:animations:completion:
这样的:
[UIView animateWithDuration:1.0f delay:2.0f options:UIViewAnimationOptionCurveEaseIn animations:^{
//your first animations
} completion:^(BOOL finished) {
[UIView animateWithDuration:1.0f delay:2.0f options:UIViewAnimationOptionCurveEaseIn animations:^{
//your second animations
} completion:^(BOOL finished) {
}];
}];
这个方法接受一个额外的参数delay
这听起来像你想要什么。而且由于你是第二个动画,所以动画将按顺序发生。
如果你想利用在动画的最后一些动作,相应的代码如下:
[UIView animateWithDuration:0.50 animations:^{
// your changes to animate here
} completion:^(BOOL completed) {
// your code after animation here
}];
有允许动画本身的更多功能animateWithDuration的其他几个变种。
您是否知道UIView动画块? – hgwhittle
是的,这就是我正在使用 – Lucas
我只是想知道为什么你使用'performSelector:afterDelay:'。你可以发布一些代码吗? – hgwhittle