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
iPhone SDK 4.0 Animation Blocks - Move Scale UIImage
提问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 scale
and transform
, and then use CGAffineTransformConcat
to combine them.
在这里,我对scale
和进行了转换transform
,然后使用CGAffineTransformConcat
它们来组合它们。
Docs are here
文档在这里
HTH
HTH