zoukankan      html  css  js  c++  java
  • 动画执行结束后 执行指定操作

    - (void)onClick:(id)sender
    {
        UIButton *helpImageBtn = (UIButton *)sender;
        [UIView animateWithDuration:1.25f
                         animati*****:^{
                             // fade out
                             helpImageBtn.alpha = 0.0f;
                         }
                         completion:^(BOOL finished){
                             // remove from super view on animation finished
                             if (helpImageBtn.superview)
                                 [helpImageBtn removeFromSuperview];
                         }];
    }



    注意,这种块动画编程只支持iOS4.0以上的版本,如果你要兼容以前的版本,需要改用[UIView beginAnimati*****:nil context:nil]的相应写法:

    - (void)onClick:(id)sender
    {
        UIButton *helpImageBtn = (UIButton *)sender;
        self.retainedHelpImageBtn = helpImageBtn;
     
        [UIView beginAnimati*****:nil context:nil];
        // fade out
        helpImageBtn.alpha = 0.0f;
        // set animation did stop selector
        [UIView setAnimationDelegate:self];
        [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
        [UIView commitAnimati*****];
    }
     
    - (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
        if (self.retainedHelpImageBtn.superview)
            [self.retainedHelpImageBtn removeFromSuperview];
    }
  • 相关阅读:
    linux
    JAVA——遍历
    linux基础命令
    Java的反射和代理以及注解
    web 前端遇到的问题
    JTopo 使用
    阿里云服务器linux(cenos)下 jdk、tomcat的安装配置
    笔记--数据库总结
    0.01的区别
    犹豫——辛苦——坚持——收获 (2019北航软工培训总结)
  • 原文地址:https://www.cnblogs.com/gaoxiao228/p/2553336.html
Copyright © 2011-2022 走看看