ios view局部透明

_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局部透明)