ios 给uiview创作遮罩
时间:2014-05-20 00:07:25
收藏:0
阅读:474
mask一定是PNG格式的图像,去掉背景 .jpg格式图片没有alpha
values
遮罩是通过图片透明度的信息实现与颜色无关
UIImage*_maskingImage
=[UIImage imageNamed:@"mask"];
CALayer*_maskingLayer =[CALayer
layer];
_maskingLayer.frame =
theView.bounds;
[_maskingLayer setContents:(id)[_maskingImage
CGImage]];
[theView.layer setMask:_maskingLayer];
评论(0)