美文网首页
ios view局部透明

ios view局部透明

作者: 孟维学 | 来源:发表于2016-12-19 22:30 被阅读310次

    _alphaView= [[UIViewalloc]initWithFrame:self.view.bounds];

    _alphaView.backgroundColor= [[UIColorblackColor]colorWithAlphaComponent:0.7];

    UIBezierPath*path = [UIBezierPathbezierPathWithRect:_alphaView.frame];

    [pathappendPath:[[UIBezierPathbezierPathWithRoundedRect:CGRectMake(100,100,50,50)cornerRadius:25]bezierPathByReversingPath]];

    CAShapeLayer*shapeLayer = [CAShapeLayerlayer];

    shapeLayer.path= path.CGPath;

    [_alphaView.layersetMask:shapeLayer];

    [self.viewaddSubview:_alphaView];

    转载:http://blog.csdn.net/ycz19930423/article/details/51150541

    相关文章

      网友评论

          本文标题:ios view局部透明

          本文链接:https://www.haomeiwen.com/subject/nefxvttx.html