如何执行图像序列的动画并拦截其完成
我有一个选项卡式应用程序,当我单击第二个选项卡时,应执行动画,然后执行其他操作。 我已经使用 [imageView startAnimating];
实现了动画,一切正常。问题是我不知道如何拦截动画过程的结束,以便执行其他操作。 我知道 UIImageView 没有委托方法。我知道 imageView.isAnimating 属性没有用。我知道使用 NSTimer 时,操作会在计时器结束时执行,即使在我的情况下用户已更改选项卡。
关于如何解决这个问题有什么想法吗?如何截取动画的结尾?
I have a tabbed application and when I click on the second tab, an animation should be performed and then other operations should be executed.
I have implemented the animation with [imageView startAnimating];
and everything works well. The problem is that I don't know how to intercept the end of the animation process, in order to perform other operations.
I know that UIImageView has no delegate methods. I know that the imageView.isAnimating
property is not useful. I know that using a NSTimer, the operation is executed at the end of timer, even if, for example, in my case the user has changed tab.
Any ideas on how to solve this issue? How to intercept the end of the animation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(2)
当您加载 UIImageView
时尝试这些:
[UIView transitionWithView: destinationView
duration:0.2f
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^ {
//Funky Animation
}
completion:^(BOOL finished) {
if(finished) {
//Funky Completion Code
}
}];
或
[UIView transitionFromView: startView
toView: destinationView
duration:0.2
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^ {
//Funky Animation
}
completion:^(BOOL finished) {
if(finished) {
//Funky Completion Code
}
}];
completion:NULL];
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我相信使用 NSTimer 是获得您想要的行为的唯一方法。但是,当计时器触发时,我会检查调用的任何方法,以确保您正在谈论的选项卡仍然打开;或者,一旦用户更改选项卡,您就可以使计时器失效。
I believe using an NSTimer is the only way to get the behavior you want. However, when the timer fires, I would include a check in whatever method gets called to make sure the tab you're talking about is still open; or you could invalidate the timer once the user changes tabs.