【发布时间】:2013-12-05 16:11:37
【问题描述】:
我有一个 UIView(背景),其中包含另一个 UIView(自定义 UI 元素)。
按下按钮将向上滑动最顶部的视图以显示更多选项。
我想对屏幕上的所有内容进行快照,但最顶部的视图及其包含的项目除外。这将用于给 iOS7 模糊效果,但正在动画的 UI 也放在屏幕截图中,这显然破坏了效果。
这是我的代码,它拍摄了整个屏幕(包括最顶部的视图)的快照。
当前代码:
-(UIImage *)blurredSnapshot
{
UIGraphicsBeginImageContext(self.view.frame.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
// Get the snapshot
UIImage *snapshotImage = UIGraphicsGetImageFromCurrentImageContext();
// Now apply the blur effect using Apple's UIImageEffect category
UIImage *blurredSnapshotImage = [snapshotImage applyLightEffect];
UIGraphicsEndImageContext();
return blurredSnapshotImage;
}
这甚至可能吗?谢谢!
【问题讨论】: