这是我的代码:
CABasicAnimation *animation = [CABasicAnimation
animationWithKeyPath:@"transform.scale"];
[animation setFromValue:[NSNumber numberWithFloat:1.0f]];
[animation setToValue:[NSNumber numberWithFloat:3.0f]];
[animation setDuration:0.8];
[animation setRemovedOnCompletion:NO];
[animation setFillMode:kCAFillModeForwards];
[imageView.layer addAnimation:animation forKey:@"scale"];
[imageView setFrame:nowRect];
我发现这不对,因为当我将imageView框架设置为nowRect时,imageView的层又变大了!