UIToolBar实现毛玻璃效果
作者:
程旭媛 | 来源:发表于
2016-08-08 14:46 被阅读102次
在viewDidLoad方法里实现以下代码就可以实现毛玻璃效果:
UIImageView *imageView1 = [[UIImageView alloc] init];
imageView1.frame = self.view.bounds;
imageView1.backgroundColor = [UIColor redColor];
//01为图片的名字
imageView1.image = [UIImage imageNamed:@"01"];
imageView1.contentMode = UIViewContentModeScaleAspectFill;
//创建一个毛玻璃
UIToolbar *toolBar = [[UIToolbar alloc] init];
toolBar.frame = imageView1.bounds;
//设置毛玻璃的样式
toolBar.barStyle = UIBarStyleBlack;
toolBar.alpha = 0.98;
[imageView1 addSubview:toolBar];
[self.view addSubview:imageView1];```
本文标题:UIToolBar实现毛玻璃效果
本文链接:https://www.haomeiwen.com/subject/phrrsttx.html
网友评论