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];

ios 给uiview创作遮罩,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!