问题描述
- 在animateWithDuration调用时旋转
- 用下面的代码动画UIView,运行正常,就是不能实现在调用时实现旋转和缩放,我想同时实现这些,需要缩放至0,并且旋转。
[UIView animateWithDuration:0.4 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^(void) { recognizer.view.transform = CGAffineTransformMakeRotation(DegreesToRadians(540)); recognizer.view.backgroundColor = [[UIColor alloc] initWithRed:220.0/255.0 green:220.0/255.0 blue:220.0/255.0 alpha:1.0]; }];
解决方案
用CGAffineTransformConcat
方法:
[UIView animateWithDuration:0.4 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^(void) { recognizer.view.transform = CGAffineTransformConcat(CGAffineTransformMakeRotation(DegreesToRadians(540)) CGAffineTransformMakeScale(1.0 1.0)); recognizer.view.backgroundColor = [[UIColor alloc] initWithRed:220.0/255.0 green:220.0/255.0 blue:220.0/255.0 alpha:1.0]; }];
希望有帮助~
时间: 2024-10-07 14:25:54