【问题标题】:UiViewAnimation not call setAnimationDidStopSelectorUiViewAnimation 不调用 setAnimationDidStopSelector
【发布时间】:2013-12-03 17:31:20
【问题描述】:

我创建了这个动画并通过停止动画进入

[UIView setAnimationDidStopSelector:@selector (TermineAnimazioneGoPointAssignedWithDelay)] ;

当 SetAnimationDidStop 的动画部分没有被调用时...你能告诉我为什么以及我在哪里做错了吗?

这是一路动画:

-(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];

}

【问题讨论】:

    标签: ios uiview uiviewanimation


    【解决方案1】:

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

    [UIView animateWithDuration:(NSTimeInterval)duration animations:^(void)animations completion:^(BOOL finished)completion]
    

    并在完成时调用[self TermineAnimazioneGoPointAssignedWithDelay]

    其次,[UIView setAnimationDidStopSelector:@selector(TermineAnimazioneGoPointAssignedWithDelay)] 不起作用,因为根据参考,必须在 在调用 beginAnimations:context: 和 commitAnimations 方法之间调用 setAnimationDidStopSelector。由于您的代码不符合此规则,因此该功能也不起作用。

    希望它能解释!祝你好运!

    【讨论】:

    • 没问题,经常查看文档:-)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-02-22
    • 2021-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-31
    相关资源
    最近更新 更多