iPhone SDK 4.0 动画 block - 移动缩放 UIImage

标签 iphone xcode ipad ios4

myImageView:

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

  } 
  completion:^(BOOL finished) {

  }
];

如何使用动画 block 对 myImageView(位置/比例)进行动画处理?

最佳答案

您需要使用 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) {

  }
];

这里我对 scaletransform 进行变换,然后使用 CGAffineTransformConcat 将它们组合起来。

文档是 here

HTH

关于iPhone SDK 4.0 动画 block - 移动缩放 UIImage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5534299/

相关文章:

iPhone:显示 iAd 问题

ios - 如何更改 SearchBar 边框颜色

iPhone:禁用 "double-tap spacebar for ."快捷方式?

ios - 我可以在不更改整个文件结构/Xcode 项目的情况下更改 Cordova/iOS 应用程序的 "displayed name"吗?

xcode - 使用 SpriteKit 场景编辑器绘制圆圈和其他形状?

iphone - 滚动 UITableView 标题?

iphone - “MyAnnotation”可能无法响应 'initWithDictionary:'

iphone - 从 NSDate 获取时区名称

objective-c - UIButton currentTitle 显示与预期不同的信息

cocoa - CGImageGetWidth 返回与实际图像不同的尺寸