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;

                    }

                }];

            });

            

     

        }];

    }

  • 相关阅读:
    在Linux CentOS上编译并安装Clang 3.5.0
    在Linux CentOS 6.6上安装Python 2.7.9
    Mac OS X上用CoreCLR运行一个真正的.NET控制台程序
    在Mac OS X上用自己编译出的CoreCLR运行.NET程序
    Mac OS X上尝试编译CoreCLR源代码
    Linux上成功编译CoreCLR源代码
    CoreCLR中超过3万行代码的gc.cpp文件的来源
    Windows上成功编译CoreCLR源代码
    “CoreCLR is now Open Source”阅读笔记
    AutoMapper指定列名进行映射
  • 原文地址:https://www.cnblogs.com/sgdkg/p/5045870.html
Copyright © 2011-2022 走看看