iOS 高斯模糊 毛玻璃效果
Posted zxs-19920314
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS 高斯模糊 毛玻璃效果相关的知识,希望对你有一定的参考价值。
1. 代码实现
1 UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]; 2 UIVisualEffectView *effectview = [[UIVisualEffectView alloc] initWithEffect:blur]; 3 effectview.frame =self.view.frame; 4 [self.view addSubview:effectview];
2.毛玻璃样式枚举
UIBlurEffect *blur = [UIBlurEffect effectWithStyle:毛玻璃样式];
1 typedef NS_ENUM(NSInteger, UIBlurEffectStyle) { 2 /* Traditional blur styles. 3 */ 4 UIBlurEffectStyleExtraLight, 5 UIBlurEffectStyleLight, 6 UIBlurEffectStyleDark, 7 UIBlurEffectStyleExtraDark API_AVAILABLE(tvos(10.0)) API_UNAVAILABLE(ios) API_UNAVAILABLE(watchos), 8 9 /* Styles which automatically show one of the traditional blur styles, 10 * depending on the user interface style. 11 * 12 * Regular displays either Light or Dark. 13 */ 14 UIBlurEffectStyleRegular API_AVAILABLE(ios(10.0)), 15 /* Prominent displays either ExtraLight, Dark (on iOS), or ExtraDark (on tvOS). 16 */ 17 UIBlurEffectStyleProminent API_AVAILABLE(ios(10.0)), 18 19 /* 20 * Blur styles available in iOS 13. 21 * 22 * Styles which automatically adapt to the user interface style: 23 */ 24 UIBlurEffectStyleSystemUltraThinMaterial API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 25 UIBlurEffectStyleSystemThinMaterial API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 26 UIBlurEffectStyleSystemMaterial API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 27 UIBlurEffectStyleSystemThickMaterial API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 28 UIBlurEffectStyleSystemChromeMaterial API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 29 30 /* And always-light and always-dark versions: 31 */ 32 UIBlurEffectStyleSystemUltraThinMaterialLight API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 33 UIBlurEffectStyleSystemThinMaterialLight API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 34 UIBlurEffectStyleSystemMaterialLight API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 35 UIBlurEffectStyleSystemThickMaterialLight API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 36 UIBlurEffectStyleSystemChromeMaterialLight API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 37 38 UIBlurEffectStyleSystemUltraThinMaterialDark API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 39 UIBlurEffectStyleSystemThinMaterialDark API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 40 UIBlurEffectStyleSystemMaterialDark API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 41 UIBlurEffectStyleSystemThickMaterialDark API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 42 UIBlurEffectStyleSystemChromeMaterialDark API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos, watchos), 43 44 } API_AVAILABLE(ios(8.0));
以上是关于iOS 高斯模糊 毛玻璃效果的主要内容,如果未能解决你的问题,请参考以下文章
移动端UI设计越来越流行的高斯模糊(Gaussian blur)和毛玻璃效果(磨砂效果),如何使用Android RenderScript简单实现?