怎么在iOS 8中利用UIBlurEffect实现毛玻璃特效
更新:HHH   时间:2023-1-8


怎么在iOS 8中利用UIBlurEffect实现毛玻璃特效?针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

//创建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

关于怎么在iOS 8中利用UIBlurEffect实现毛玻璃特效问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注天达云行业资讯频道了解更多相关知识。

返回移动开发教程...