更新时间:2023-02-09 20:32:12
那个绘制代码不会影响动画块
That drawing code will have no affect in an animation block
请尝试以下操作:
// Create a view with a corner radius as the circle
UIView* circle = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 100, 100)];
[circle.layer setCornerRadius:circle.frame.size.width / 2];
[circle setBackgroundColor:[UIColor redColor]];
[self.view addSubview:circle];
[UIView animateWithDuration:5 animations:^{
// Animate it to double the size
const CGFloat scale = 2;
[circle setTransform:CGAffineTransformMakeScale(scale, scale)];
}];