美文网首页
学习笔记:添加毛玻璃的几种方式

学习笔记:添加毛玻璃的几种方式

作者: _sun1993 | 来源:发表于2016-11-03 03:50 被阅读0次

1.添加到imageView上
/*
毛玻璃的样式(枚举)
UIBlurEffectStyleExtraLight,
UIBlurEffectStyleLight,
UIBlurEffectStyleDark
*/
// 添加毛玻璃效果
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
effectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
effectView.frame = backImageView.bounds;
[backImageView addSubview:effectView];
2.添加toolbar
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0 , bgImgView.frame.size.width, bgImgView.frame.size.height)];
toolbar.barStyle = UIBarStyleBlackTranslucent;
[bgImgView addSubview:toolbar];

相关文章

网友评论

      本文标题:学习笔记:添加毛玻璃的几种方式

      本文链接:https://www.haomeiwen.com/subject/ohebuttx.html