gpt4 book ai didi

ios - 正确使用完: in setAnimationDidStopSelector:?

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:51:45 25 4
gpt4 key购买 nike

我有一些扑克牌,当你点击它们时,它们会翻过来。我希望在翻转动画完成后发生一些事情,所以我在我的 UIView 动画周期中有这个:

[UIView setAnimationDidStopSelector:@selector(flipAnimationDone:finished:context:)];

...这叫做:

-(void)flipAnimationDone:(NSString *)animationID finished:(BOOL)finished context:(void *)context {
if (finished == YES) {
// other stuff here
}
}

现在,我需要 if (finished == YES) 位,否则 other stuff 将触发 ,即使用户点击卡片再次中间动画,这很糟糕——它只需要在翻转动画完全完成时发生:)

问题是,这是行不通的。如果我在那里有 if,则 other stuff 永远不会触发,无论如何。如果我将 if 排除在外,其他内容就会触发,但可能会在错误的时间触发。

我在 finished 位上做错了什么导致它无法正常工作?

谢谢!

最佳答案

注意文档说方法签名是

- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context;

具体而言,

finished
An NSNumber object containing a Boolean value. The value is YES if the animation ran to completion before it stopped or NO if it did not.

所以,你应该让它(NSNumber *)finishedif ([finished boolValue]) { ... }

关于ios - 正确使用完: in setAnimationDidStopSelector:?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6965053/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com