iOS制作毛玻璃效果

//添加一个图片

UIImageView *imageview = [[UIImageView alloc]init];

imageview.frame = CGRectMake(10, 100, 300, 300);

imageview.contentMode = UIViewContentModeScaleAspectFit;

imageview.userInteractionEnabled = YES;

imageview.image = [UIImage imageNamed:@"3.jpg"];

[self.view addSubview:imageview];

//模糊效果代码

UIBlurEffect *errect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];

UIVisualEffectView *ectView = [[UIVisualEffectView alloc]initWithEffect:errect];
ectView.alpha = 0.6;

ectView.frame = CGRectMake(0, 0, imageview.frame.size.width/2, 300);

[imageview addSubview:ectView];

UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];

btn.frame =CGRectMake(10,50, 100, 40);
[btn setTitle:@"btn"forState:UIControlStateNormal];
[ectView.contentView addSubview:btn];
上一篇:2018-2019-2 网络对抗技术 20165230 Exp2 后门原理与实践


下一篇:Elasticsearch索引和文档操作