UIVisualEffectView毛玻璃

iOS8苹果新增了毛玻璃接口:

UIImageView *imageV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_SCREEN_HEIGHT)];
imageV.image = [UIImage imageNamed:@"Dva2"];
imageV.contentMode = UIViewContentModeScaleAspectFill;
imageV.clipsToBounds = YES;
[self.view addSubview:imageV];
    
UIVisualEffectView *visualView = [[UIVisualEffectView alloc]initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
visualView.frame = imageV.bounds;
[imageV addSubview:visualView];

把UIVisualEffectView覆盖在图层上即可,effectWithStyle:参数是个枚举,提供不同亮度的毛玻璃效果

你可能感兴趣的:(UIVisualEffectView毛玻璃)