iOS 7风格模糊视图 [英] iOS 7 style Blur view

查看:79
本文介绍了iOS 7风格模糊视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人知道将复制iOS7样式模糊视图的任何控件。

Does anybody know of any controls that will replicate the iOS7 style blur views.

我认为可能存在某种会复制行为的UIView子类。

I'm assumming there can be some kind of UIView subclass that will replicate the behavior.

我说的是这些类型的视图,它们背景非常厚,因此它们具有背景视图中的拉力效果。

I'm talking about these type views which blur the background extremely thickly so that they have pull effects from the background view.

推荐答案

您可以修改像Bin Zhang的 RWBlurPopover 之类的内容。去做这个。该组件使用我的GPUImage将高斯模糊应用于其下的组件,但您也可以轻松地使用CIGaussianBlur。 GPUImage可能是头发但是更快

You might be able to modify something like Bin Zhang's RWBlurPopover to do this. That component uses my GPUImage to apply a Gaussian blur to components underneath it, but you could just as easily use a CIGaussianBlur for the same. GPUImage might be a hair faster though.

该组件依赖于您能够捕获您正在呈现的视图背后的视图,并且可能会遇到视图问题在这个内容背后动画。需要通过Core Graphics浏览栅格化背景视图会减慢速度,因此我们可能没有足够的直接访问权限,无法以高效的方式执行此操作,以便在动画视图上进行叠加。

That component relies on you being able to capture the view behind the one you're presenting, though, and may have trouble with views that animate behind this content. The need to take a trip through Core Graphics to rasterize the background view will slow things down, so we probably don't have sufficiently direct access to be able to do this in a performant manner for overlays on animating views.

作为对上述内容的更新,我最近重新设计了GPUImage中的模糊以支持变量半径,允许在iOS 7的控制中心视图中完全复制模糊大小。从那时起,我创建了GPUImageiOS7BlurFilter类,它封装了Apple似乎在这里使用的正确模糊大小和颜色校正。这就是GPUImage模糊(右侧)与内置模糊(左侧)的比较:

As an update to the above, I recently reworked the blurs in GPUImage to support variable radii, allowing for the complete replication of the blur size in iOS 7's control center view. From that, I created the GPUImageiOS7BlurFilter class that encapsulates the proper blur size and color correction that Apple appears to be using here. This is how GPUImage's blur (on the right) compares to the built-in blur (on the left):

我使用4X下采样/上采样来减少高斯模糊操作所需的像素数,因此iPhone 4S可以使用此操作在大约30 ms内模糊整个屏幕。

I use a 4X downsampling / upsampling to reduce the number of pixels the Gaussian blur has to operate over, so an iPhone 4S can blur the entire screen in roughly 30 ms using this operation.

你仍然面临着如何以高效的方式从这个背后的视图中提取内容的挑战。

You still have the challenge of how to pull content into this blur from views behind this one in a performant manner.

这篇关于iOS 7风格模糊视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆