当前位置: 移动技术网 > 移动技术>移动开发>IOS > iOS 8使用UIBlurEffect实现毛玻璃特效

iOS 8使用UIBlurEffect实现毛玻璃特效

2019年07月24日  | 移动技术网移动技术  | 我要评论

ios 8 后使用uiblureffect 类和uivisualeffectview 类添加毛玻璃特效更加便捷,高效。

//创建imageview
iimageview *imageview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"5"]];
  // 创建需要的毛玻璃特效类型
  /**
   * uiblureffectstyleextralight,
   * uiblureffectstylelight,
   * uiblureffectstyledark
   */
  uiblureffect *blur = [uiblureffect effectwithstyle:uiblureffectstyleextralight];

  //添加到要有毛玻璃特效的控件中
  uivisualeffectview *visual = [[uivisualeffectview alloc] initwitheffect:blur];
  visual.frame = imageview.bounds;
  [self.view addsubview:imageview];

效果图:

原图:

(1) uiblureffectstyleextralight

(2) uiblureffectstylelight

(3) uiblureffectstyledark

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网