如何等待动画师完成? [英] How to wait for an animator to finish?

查看:102
本文介绍了如何等待动画师完成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个简单的问题,但我似乎不知道如何做。基本上我想做的就是在关闭之前淡入一个窗口:

This is probably a simple question but I can't seem to figure out how to do it. Basically all I want to do is fade a window before closing it:

[[window animator] setAlphaValue:0.0];
[window close];

这个工作正常,没有[窗口关闭],但当包括窗口似乎关闭它在动画结束之前(这显然不是我想要的);对于orderOut :, performClose:等同样的情况也是如此。有没有办法避免这种情况?

This works fine without the [window close], but when that is included the window seems to close it before the animation finishes (which is obviously not what I want); the same seems to happen for orderOut:, performClose:, etc. Is there any way to avoid this?

推荐答案

[[window animator] setAlphaValue:0.0];
[window performSelector:@selector(performClose:) withObject:self afterDelay:[[NSAnimationContext currentContext] duration]];

这篇关于如何等待动画师完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆