蒙版样例

self.bgImageView = [[UIImageView alloc]init];
_bgImageView.frame = self.frame;
[_bgImageView setImage:[UIImage imageNamed:@"jindu1.png"]];
[self addSubview:_bgImageView];
[_bgImageView release];

self.maskLayer = [CALayer layer];
_maskLayer.bounds = _bgImageView.bounds;
_maskLayer.anchorPoint = CGPointZero;
_maskLayer.contents = (id)[[UIImage imageNamed:@"jindu.png"] CGImage];

_maskLayer.frame = CGRectMake(_maskLayer.frame.origin.x,_maskLayer.frame.origin.y+_maskLayer.frame.size.height-20, _maskLayer.frame.size.width, 0);
NSLog(@"%@",_maskLayer.description);
_bgImageView.layer.mask = _maskLayer;
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(handleTimer: )userInfo:nil repeats:YES] ;

你可能感兴趣的:(蒙版样例)