标签:
//
// ViewController.m
// Wjk-day2-咻一咻2016年
//
// Created by 王建科 on 16/4/11.
// Copyright © 2016年 第一小组. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@property(nonatomic,weak) UIView* pictureView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0];
[self addPutUp];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)addPutUp{
UIButton * but = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
[but setImage:[UIImage imageNamed:@"alipay_msp_op_success"] forState:UIControlStateNormal];//@"alipay_msp_op_success" 图片名
[but setBackgroundImage:[UIImage imageNamed:@"alipay_msp_op_success"] forState:UIControlStateNormal];
but.center = self.view.center;
// 69 176 249
but.backgroundColor = [UIColor colorWithRed:69/255.0 green:176/255.0 blue:249/255.0 alpha:1];
[self.view addSubview:but];
but.layer.cornerRadius = 50;
[but addTarget:self action:@selector(tagetbutton:) forControlEvents:UIControlEventTouchUpInside];
}
- (UIView*)addPutUpView{
UIView * big = [[UIView alloc]initWithFrame:CGRectMake(0,0, 100, 100)];
big.center = self.view.center;
big.layer.cornerRadius = 50;
big.backgroundColor = [UIColor colorWithRed:69/255.0 green:176/255.0 blue:249/255.0 alpha:1];
// [big.image = [UIImage imageNamed:@"alipay_msp_op_success"] ;
// _pictureView = big;
// return big;
return big;
}
-(void)tagetbutton:(UIButton*)button{
// button.enabled=NO;
for(int i = 0;i<10;i++){
UIView * big = [self addPutUpView];
[self.view insertSubview:big belowSubview:button];
[ UIButton animateWithDuration:5
delay:1*i
usingSpringWithDamping:1
initialSpringVelocity:0.5
options:0
animations:^{
CGFloat multiple=8.0f;
// _pictureView.transform = CGAffineTransformMakeScale(multiple, multiple);
// [self addPutUpView].transform = CGAffineTransformMakeScale(multiple, multiple);
big.transform = CGAffineTransformMakeScale(multiple, multiple);
// big.backgroundColor = self.view.backgroundColor;
big.alpha=0;
}
completion:^(BOOL finished) {
[big removeFromSuperview];
}];
}
}
@end
标签:
原文地址:http://www.cnblogs.com/wjkboke/p/5380712.html