我正在尝试在名为 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 会重新布局它的子视图,我正在做的是在设备旋转(UIApplicationDidChangeStatusBarOrientationNotification
)之后重新生成 srcView 的屏幕截图,所以 imageView 似乎有点“跳跃”。有没有办法避免它“跳跃”?