• 微博弹性按钮


    //微博弹性动画

    - (void)moveInAnimation{

        

        

        UIView *centerV = [[UIView alloc] initWithFrame:CGRectMake(0, 200, 300, 100)];

        [self.view addSubview:centerV];

        

        for (int i = 0; i < 6; i ++) {

            

            CGFloat x = (i % 3) * 300 / 3.0;

            CGFloat y = (i / 3) * 100 / 2.0 ;

            

            UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(x,y, 80, 30)];

            [btn setTitle:[NSString stringWithFormat:@"按钮%d",i] forState:UIControlStateNormal];

            [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

            [self.visableArray addObject:btn];

            [centerV addSubview:btn];

            

        }

        

        [self moveInAnimation];

        

        

        [self.visableArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {

            UIButton * btn = obj;

            CGFloat x = btn.frame.origin.x;

            CGFloat y = btn.frame.origin.y;

            CGFloat width = btn.frame.size.width;

            CGFloat height = btn.frame.size.height;

            btn.frame = CGRectMake(x,  [UIScreen mainScreen].bounds.size.height + y - 200  , width, height);

            btn.alpha = 0.0;

            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(idx * 0.03 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

                [UIView animateWithDuration:0.95 delay:0 usingSpringWithDamping:2.85 initialSpringVelocity:25 options:UIViewAnimationOptionCurveEaseIn animations:^{

                    btn.alpha = 1;

                    btn.frame = CGRectMake(x, y, width, height);

                } completion:^(BOOL finished) {

                    if ([btn isEqual:[self.visableArray lastObject]]) {

    //                    self.superview.superview.userInteractionEnabled = YES;

                    }

                }];

            });

            

     

        }];

    }

  • 相关阅读:
    数据库的未来:ORM+LINQ+RX
    工具论-科学是实用工具
    事务、锁与原子性
    ORM-面向对象&关系数据库
    swift Class的内存布局
    使用phpexcel导出到xls文件的时候出现乱码解决
    苹果CMS
    js网页如何获取手机屏幕宽度
    常用正则说明
    php中的线程、进程和并发区别
  • 原文地址:https://www.cnblogs.com/sgdkg/p/5045870.html
Copyright © 2020-2023  润新知