【问题标题】:iPhone SDK 4.0 Animation Blocks - Move Scale UIImageiPhone SDK 4.0 动画块 - 移动缩放 UIImage
【发布时间】:2011-07-28 21:42:13
【问题描述】:

myImageView:

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

  } 
  completion:^(BOOL finished) {

  }
];

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

【问题讨论】:

    标签: iphone xcode ipad ios4


    【解决方案1】:

    你需要使用 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-03-31
      • 2011-11-29
      • 2012-07-08
      • 1970-01-01
      • 2017-05-30
      • 2015-03-30
      • 1970-01-01
      相关资源
      最近更新 更多