首页 > 代码库 > 让view有弹性效果

让view有弹性效果

让view有弹性效果

by 伍雪颖

- (void)viewDidLoad {
    [super viewDidLoad];
    CGAffineTransform transform = _view1.transform;
    transform = CGAffineTransformScale(self.view1.transform, 2, 2);
    self.view1.transform = transform;
}

- (IBAction)button:(id)sender {
    __block ViewController *wself = self;
    [UIView animateWithDuration:1.0 delay:0 usingSpringWithDamping:0.1 initialSpringVelocity:0.1 options:0 animations:^{
        CGAffineTransform transform = wself.view1.transform;
        transform = CGAffineTransformScale(wself.view1.transform, 0.9, 0.9);
        wself.view1.transform = transform;
    } completion:nil];
}