Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/97.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 缩放图像序列_Ios - Fatal编程技术网

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