xcode iPhone SDK 4.0 动画块 - 移动缩放 UIImage

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5534299/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:43:45  来源:igfitidea点击:

iPhone SDK 4.0 Animation Blocks - Move Scale UIImage

iphonexcodeipadios4

提问by Mason

myImageView:

myImageView

[UIView animateWithDuration:1.5 delay:0.0 options:UIViewAnimationOptionCurveLinear 
  animations:^{

  } 
  completion:^(BOOL finished) {

  }
];

How can I animate myImageView(position/scale) using animation blocks?

如何myImageView使用动画块制作动画(位置/比例)?

回答by Mason

You need to use CGAffineTransformations, like this:

您需要使用 CGAffineTransformations,如下所示:

[UIView animateWithDuration:1.5 delay:0.0 options:UIViewAnimationOptionCurveLinear 
  animations:^{
      CGAffineTransform scale = CGAffineTransformMakeScale(2.0, 2.0);
      CGAffineTransform translate = CGAffineTransformMakeTranslation(10.0, 10.0);

      self.myImageView.transform = CGAffineTransformConcat(scale, translate);

  } 
  completion:^(BOOL finished) {

  }
];

Here I make transforms for scaleand transform, and then use CGAffineTransformConcatto combine them.

在这里,我对scale和进行了转换transform,然后使用CGAffineTransformConcat它们来组合它们。

Docs are here

文档在这里

HTH

HTH