zoukankan      html  css  js  c++  java
  • 微博弹性按钮

    //微博弹性动画

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

                    }

                }];

            });

            

     

        }];

    }

  • 相关阅读:
    JSP EL表达式
    JSP 核心标签库
    windows查看占用端口的进程
    JSP 自定义标签
    JSON-LD
    Java 国际化
    Java Web的两种开发模式
    CSS 图片加载完成再淡入显示
    Windows 让cmd启动的程序在后台运行
    Maven使用
  • 原文地址:https://www.cnblogs.com/sgdkg/p/5045870.html
Copyright © 2011-2022 走看看