不调用AnimationDidStop

编程入门 行业动态 更新时间:2024-10-24 01:56:47
本文介绍了不调用AnimationDidStop的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的animationDidStop方法由于某种原因未被调用,起初我以为是因为未设置委托,但补救了我仍然遇到同样的问题.有任何想法吗?在此先感谢:)

My animationDidStop method is not being called for some reason, initially I thought it was because the delegate was not set but having remedied that I'm still having the same problem. Any ideas? thanks in advance :)

- (void)hideInterfaceButtonClicked : (id) sender { [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(animationDidStop)]; [UIView beginAnimations:@"MoveView" context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; [UIView setAnimationDuration:0.5]; // Move to the right CGAffineTransform translateInterface = CGAffineTransformMakeTranslation(454,288); // Scale CGAffineTransform scale = CGAffineTransformMakeScale(0.20,0.20); // Apply them to the view self.transform = CGAffineTransformConcat(scale, translateInterface); self.alpha = 0.0; [UIView commitAnimations]; } - (void)animationDidStop { NSLog(@"Animation Has Stopped"); [[NSNotificationCenter defaultCenter] postNotificationName:@"hiddenInteraceViewNeeded" object:self]; //after MoveView finishes }

推荐答案

您可以使用新的(iOS4 +)块语法:

You could achieve what you want by using the new (iOS4+) block syntax:

[UIView animateWithDuration:0.5 delay:0.0 options:UIViewAnimationCurveEaseIn animations:^{ // Move to the right CGAffineTransform translateInterface = CGAffineTransformMakeTranslation(454,288); // Scale CGAffineTransform scale = CGAffineTransformMakeScale(0.20,0.20); // Apply them to the view self.transform = CGAffineTransformConcat(scale, translateInterface); self.alpha = 0.0; } completion:^(BOOL finished) { NSLog(@"Animation Has Stopped"); [[NSNotificationCenter defaultCenter] postNotificationName:@"hiddenInteraceViewNeeded" object:self]; //after MoveView finishes }];

更多推荐

不调用AnimationDidStop

本文发布于:2023-10-28 19:18:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1537541.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:AnimationDidStop

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!