我使用以下代码为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];
}];
答案 0 :(得分:11)
只需使用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];
}];
希望有帮助!