首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UiViewAnimation不调用setAnimationDidStopSelector

UiViewAnimation不调用setAnimationDidStopSelector
EN

Stack Overflow用户
提问于 2013-12-03 17:31:20
回答 1查看 246关注 0票数 0

我创建了这个动画,并通过停止动画输入。

代码语言:javascript
复制
[UIView setAnimationDidStopSelector:@selector (TermineAnimazioneGoPointAssignedWithDelay)] ;

当SetAnimationDidStop的动画部分未被调用时.你能告诉我为什么和哪里做错了吗?

这就是所有的动画:

代码语言:javascript
复制
-(void)setViewStatusGoPointassigned {
    ViewgoPointAssignMessage = [[UIView alloc] initWithFrame:CGRectMake(115, 150, 100, 100) ];
    ViewgoPointAssignMessage.backgroundColor = [UIColor colorWithRed:(77/255.0) green:(108/255.0) blue:(143/255.0) alpha:(1)];
    [ViewgoPointAssignMessage.layer setCornerRadius:10.0f];
    [ViewgoPointAssignMessage.layer setMasksToBounds:YES];

    [UIView animateWithDuration:0.2 animations:^{

        ViewgoPointAssignMessage.transform = CGAffineTransformMakeScale(1.05, 1.05);
        ViewgoPointAssignMessage.alpha = 0.8; }
                     completion:^(BOOL finished){

                         [UIView animateWithDuration:2/15.0 animations:^{
                             ViewgoPointAssignMessage.transform = CGAffineTransformMakeScale(0.9, 0.9);
                             ViewgoPointAssignMessage.alpha = 0.9; }
                                          completion:^(BOOL finished) {

                                              [UIView animateWithDuration:1/7.5 animations:^{
                                                  ViewgoPointAssignMessage.transform = CGAffineTransformIdentity;
                                                  ViewgoPointAssignMessage.alpha = 1.0; } ];


                                          } ];
                     } ];

    [self.view addSubview:ViewgoPointAssignMessage];
    [UIView setAnimationDidStopSelector:@selector(TermineAnimazioneGoPointAssignedWithDelay)];

}

-(void)TermineAnimazioneGoPointAssignedWithDelay {
    [self performSelector:@selector(EliminazioneViewAfterDelay) withObject:self afterDelay:0.01];
}
-(void)EliminazioneViewAfterDelay {
    CGRect endREct;
    endREct = CGRectMake(350 , 0 , 330, 90);
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.005];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(EliminaAnimazione)];
     ViewgoPointAssignMessage.frame = endREct;
    [UIView commitAnimations];

}
- (void)EliminaAnimazione {
    [ViewgoPointAssignMessage removeFromSuperview];

}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-12-03 17:43:22

首先,回答你的问题。你可以试试

代码语言:javascript
复制
[UIView animateWithDuration:(NSTimeInterval)duration animations:^(void)animations completion:^(BOOL finished)completion]

并在完成过程中调用[self TermineAnimazioneGoPointAssignedWithDelay]

其次,[UIView setAnimationDidStopSelector:@selector(TermineAnimazioneGoPointAssignedWithDelay)]不能工作,因为根据引用,setAnimationDidStopSelector必须在对入门动画:context:和commitAnimations方法的调用之间调用。由于您的代码不符合这一规则,该函数也无法工作。

希望它能解释!祝好运!

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20357824

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档