end*_*ndy 113 core-graphics objective-c ios
有没有人知道任何会复制iOS7风格模糊视图的控件.
我在假设可以有某种UIView子类来复制行为.
我在谈论这些类型的视图,它们将背景模糊得非常厚,以便它们从背景视图中获得拉动效果.


Bra*_*son 41
您可能可以修改Bin Zhang的RWBlurPopover之类的东西来执行此操作.该组件使用我的GPUImage将高斯模糊应用于其下面的组件,但您也可以轻松地使用CIGaussianBlur.虽然GPUImage可能会更快.
但是,该组件依赖于您能够捕获您正在呈现的视图背后的视图,并且可能会遇到有关此内容背后动画的视图的问题.需要通过Core Graphics浏览栅格化背景视图会降低速度,因此我们可能没有足够的直接访问权限,无法以高效的方式执行此操作以在动画视图上进行叠加.
作为对上述内容的更新,我最近重新设计了GPUImage中的模糊以支持变量半径,允许在iOS 7的控制中心视图中完全复制模糊大小.从那时起,我创建了GPUImageiOS7BlurFilter类,它封装了Apple似乎在这里使用的正确模糊大小和颜色校正.这就是GPUImage的模糊(右侧)与内置模糊(左侧)的比较:

我使用4X下采样/上采样来减少高斯模糊操作所需的像素数,因此iPhone 4S可以使用此操作在大约30 ms内模糊整个屏幕.
你仍然面临着如何以高效的方式将内容从这个背后的视图中拉入这个模糊的挑战.
Pau*_*len 29
我正在使用FXBlurView哪个适用于iOS5 +
https://github.com/nicklockwood/FXBlurView
的CocoaPods:
-> FXBlurView (1.3.1)
UIView subclass that replicates the iOS 7 realtime background blur effect, but works on iOS 5 and above.
pod 'FXBlurView', '~> 1.3.1'
- Homepage: http://github.com/nicklockwood/FXBlurView
- Source: https://github.com/nicklockwood/FXBlurView.git
- Versions: 1.3.1, 1.3, 1.2, 1.1, 1.0 [master repo]
Run Code Online (Sandbox Code Playgroud)
我使用以下方法添加:
FXBlurView *blurView = [[FXBlurView alloc] initWithFrame:CGRectMake(50, 50, 150, 150)];
[self.blurView setDynamic:YES];
[self.view addSubview:self.blurView];
Run Code Online (Sandbox Code Playgroud)
cpr*_*ack 27
警告:评论中的某些人声称Apple拒绝使用此技术的应用程序.这没有发生在我身上,只是为了你的考虑.
这可能会让您感到惊讶,但您可以使用UIToolbar,它已包含该标准效果(仅限iOS 7+).在您查看控制器的viewDidLoad:
self.view.opaque = NO;
self.view.backgroundColor = [UIColor clearColor]; // Be sure in fact that EVERY background in your view's hierarchy is totally or at least partially transparent for a kind effect!
UIToolbar *fakeToolbar = [[UIToolbar alloc] initWithFrame:self.view.bounds];
fakeToolbar.autoresizingMask = self.view.autoresizingMask;
// fakeToolbar.barTintColor = [UIColor white]; // Customize base color to a non-standard one if you wish
[self.view insertSubview:fakeToolbar atIndex:0]; // Place it below everything
Run Code Online (Sandbox Code Playgroud)
Viv*_*ier 13
从iOS8开始,您可以使用UIBlurEffect.
iOS8Sampler上有一个很好的例子,包括UIBlurEffect和UIVibrancyEffect.
Jea*_*ler 13
获得blured Overlay的最佳新方法是使用新的iOS 8 Feature UIVisualEffectView.
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *bluredView = [[UIVisualEffectView alloc] initWithEffect:effect];
bluredView.frame = self.view.bounds;
[self.view addSubview:bluredView];
Run Code Online (Sandbox Code Playgroud)
UIBlurEffect支持三种Style.Dark,Light和ExtraLight.
| 归档时间: |
|
| 查看次数: |
64933 次 |
| 最近记录: |