【问题标题】:How to scale and rotate during single animateWithDuration call如何在单个 animateWithDuration 调用期间缩放和旋转
【发布时间】:2013-01-20 23:21:48
【问题描述】:

我正在使用以下代码为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];   
                 }];

【问题讨论】:

    标签: iphone ios objective-c animation uikit


    【解决方案1】:

    只需使用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];   
                     }];
    

    希望有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-20
      • 1970-01-01
      • 2019-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多