iOS 7 以前
- 使用 CoreImage
- 使用 GPUImage
- 使用 vImage
iOS 8 及以后
- 使用UIVisualEffect以及UIVisualEffectView
UIVisualEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
visualEffectView.frame = imageView.bounds
[imageView addSubview:visualEffectView];
UIBlurEffect 的种类
- UIBlurEffectStyleExtraLight – 模糊後加入和模糊對象相比更明亮的色相( Hue )調整效果
- UIBlurEffectStyleLight – 模糊後加入和模糊對象相等的色相調整效果
- UIBlurEffectStyleDark – 模糊後加入和模糊對象相比更暗色的色相調整效果
网友评论