Ios 缩放图像序列
我尝试使用Ios 缩放图像序列,ios,Ios,我尝试使用imageView.animationImages并调用[self.imageView startAnimating]缩放运行图像序列的UIImageView - (void) updateViewSizeWithScale:(float) scale { // calculate the new size based on the scale int newSize = originalSize * scale; [UIView animateWithDur
imageView.animationImages
并调用[self.imageView startAnimating]缩放运行图像序列的UIImageView代码>
- (void) updateViewSizeWithScale:(float) scale
{
// calculate the new size based on the scale
int newSize = originalSize * scale;
[UIView animateWithDuration:0.4 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.imageView.frame = CGRectMake(self.imageView.frame.origin.x, self.imageView.frame.origin.y, newSize, newSize);
} completion:^(BOOL finished) {
}];
这不会在动画图像运行时缩放UIImageView。我尝试在动画块中设置self.frame(self是UIView子类),但它不缩放imageview
在容器视图中运行图像序列并缩放容器的最佳方式是什么,以便图像在序列运行时缩放
我应该使用层还是更低级别的API?考虑使用CGAffine转换来完成这项工作:
[UIView animateWithDuration:0.4 delay:0.0 UIViewAnimationOptionCurveEaseInOut animations:^{
CGAffineTransform newScale = CGAffineTransformMakeScale(2.0, 2.0);
CGAffineTransform newTranslate = CGAffineTransformMakeTranslation(10.0, 10.0);
self.myImageView.transform = CGAffineTransformConcat(newScale, newTranslate);
}
completion:^(BOOL finished) {
}
];
我昨天也遇到了同样的问题,在设置了两件事之后,它起了作用:
self.imageView.clipsToBounds = YES;
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
希望对您有用。我有一个问题,图像大小随着帧的旋转而增大。太好了。我明天试试这个。谢谢否则cocos2d:P