zoukankan      html  css  js  c++  java
  • 动画完成后再执行方法的两个方法

    - (void)smallImg

    {

        // 执行动画

        [UIView animateWithDuration:0.25 animations:^{

            // 存放需要执行动画的代码

            

            // 1.头像慢慢变为原来的位置和尺寸

            self.iconBtn.frame = CGRectMake(85, 80, 150, 150);

            

            // 2.阴影慢慢消失

            self.cover.alpha = 0.0;

        } completion:^(BOOL finished) {

            // 动画执行完毕后会自动调用这个block内部的代码

            

            // 3.动画执行完毕后,移除遮盖(从内存中移除)

            [self.cover removeFromSuperview];

            self.cover = nil;

        }];

        

        // 1.删除阴影

    //    [self.cover removeFromSuperview];

    //    self.cover = nil;

        

        // 2.恢复头像原来的位置

    //    [UIView beginAnimations:nil context:nil];

    //    [UIView setAnimationDuration:1.0];

    //    [UIView setAnimationDelegate:self];

    //    [UIView setAnimationDidStopSelector:@selector(removeCover)];

    //    [UIView commitAnimations];

    }

    //- (void)removeCover

    //{

    //    [self.cover removeFromSuperview];

    //    self.cover = nil;

    //}

    动画镶嵌

    - (IBAction)download:(UIButton *)btn {

        // 1.让按钮失效(文字变为"已下载")

        btn.enabled = NO;

        

        // 2.显示下载成功的信息("成功下载xxx")

        UILabel *label = [[UILabel alloc] init];

        label.text = [NSString stringWithFormat:@"成功下载%@", self.app.name];

        label.font = [UIFont systemFontOfSize:12];

        label.textAlignment = NSTextAlignmentCenter;

        label.textColor = [UIColor whiteColor];

        label.backgroundColor = [UIColor blackColor];

        label.frame = CGRectMake(0, 0, 150, 25);

        label.center = CGPointMake(160, 240);

        label.alpha = 0.0;

        

        // 巧妙利用控件的尺寸和圆角半径,能产生一个圆

        label.layer.cornerRadius = 5;

        // 超出主层边界的内容统统剪掉

    //    label.layer.masksToBounds = YES;

        label.clipsToBounds = YES;

        

        [self.superview addSubview:label];

        

        // 3.动画

        [UIView animateWithDuration:1.0 animations:^{

            label.alpha = 0.5;

        } completion:^(BOOL finished) {

            [UIView animateWithDuration:1.0 delay:1.0 options:UIViewAnimationOptionCurveLinear animations:^{

                label.alpha = 0.0;

            } completion:^(BOOL finished) {

                [label removeFromSuperview];

            }];

        }];

    }

  • 相关阅读:
    数据仓库的直白概述
    Google准实时数据仓库Mesa(一)
    活动预告丨易盾CTO朱浩齐将出席2018 AIIA大会,分享《人工智能在内容安全的应用实践》
    3招搞定APP注册作弊
    【0门槛】PR稿的自我修养
    Hive中文注释乱码解决方案(2)
    Hive中文注释乱码解决方案
    网易考拉Android客户端网络模块设计
    有运气摇号来不及挑选?网易有数帮你科学选房
    selenium下拉框踩坑埋坑
  • 原文地址:https://www.cnblogs.com/supper-Ho/p/6221162.html
Copyright © 2011-2022 走看看