Ios 应用于UIView的实时文件管理器?

Ios 应用于UIView的实时文件管理器?,ios,uiview,filter,core-image,Ios,Uiview,Filter,Core Image,我试图在名为srcView的UIView实例上添加一个过滤器视图。我正在做的事情如下: //Generate the screenshot of srcView UIGraphicsBeginImageContext(srcView.bounds.size); [srcView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageConte

我试图在名为srcView的UIView实例上添加一个过滤器视图。我正在做的事情如下:

//Generate the screenshot of srcView
UIGraphicsBeginImageContext(srcView.bounds.size);
[srcView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

NSData *imageData = UIImageJPEGRepresentation(image, 1); // convert to jpeg
image = [UIImage imageWithData:imageData];

//A custom filter effect applied on a image
imageView.image = [image boxblurImageWithBlur:kStyleBlur];

它很好用。但是当设备旋转时,由于srcView将重新显示其子视图,所以我要做的是在设备旋转后重新生成srcView的屏幕截图(
uiapplicationidchangestatusbarorientationnotification
),因此imageView似乎有点“跳跃”。有没有办法避免它“跳跃”?

您愿意实现动画吗? 你可以试试:

CGAffineTransform transform = CGAffineTransformMakeRotation(3.14159/2);
imageView.transform = transform;

// Repositions and resizes the imageview.
CGRect contentRect = //the new rect
imageView.bounds = contentRect;

谢谢@Luke!我想你误解了我的问题。imageView(image)的内容基于srcView的内容。发生旋转时,srcView将重新显示其子视图,这意味着其内容将发生更改。所以需要重新生成imageView的内容,这将使imageView的旋转动画跳跃。是的,我理解错了,对不起。你能解释一下你在说什么吗?谢谢你的回复!imageView的内容取决于srcView的内容,因此,当发生旋转时,我必须等待旋转完成,然后重新生成imageView的内容。但是你知道,当旋转发生时,imageView有它自己的动画来根据它的
自动调整大小任务
来旋转自己。因此,旋转完成后“重新生成”imageView内容的过程将被视为跳转。