IOS 设置透明度导致底层View始终可见

来源:互联网 发布:青山预算软件 编辑:程序博客网 时间:2024/05/31 19:07
正确效果如图:下面的toolBar应该看不见它下面的View,

避免方法:[self.view  addSubView:aSubView];这个aSubView一定不能设置不透明度,应将其设置为ClearCorlor,然后在aSubView中设置BackgroundView,将backgroundView设置透明度

-(void)setupViews{    self.backgroundColor =[UIColor clearColor];    if (_bacgroundView == nil) {        _bacgroundView = [[UIView alloc] init];        _bacgroundView.backgroundColor = [UIColor whiteColor];        _bacgroundView.alpha = 0.3;    }    [self addSubview:_bacgroundView];}

  

0 0
原创粉丝点击