iOS缩放动画
2017-12-16 本文已影响1353人
赤焰军少帅林殊
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
view.backgroundColor = [UIColor redColor];
[self.view addSubview:view];
CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"transform.scale"];
animation.fromValue=[NSNumber numberWithFloat:0.5];
animation.toValue=[NSNumber numberWithFloat:1.0];
animation.duration=1.0;
animation.autoreverses=YES;
animation.repeatCount=0;
animation.removedOnCompletion=NO;
animation.fillMode=kCAFillModeForwards;
[view.layer addAnimation:animation forKey:@"zoom"];