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));

 

文章来自:https://www.cnblogs.com/zxs-19920314/p/12809814.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3