码迷,mamicode.com
首页 > 其他好文 > 详细

使用CAShapeLayer绘制镂空的图层

时间:2015-12-08 20:11:15      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:

结合上面两篇,做一个镂空的图层--》可用于app内的新手指引-----直接上代码:

在markView.m里面的代码如下:

UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0,0,self.bounds.size.width, self.bounds.size.height)cornerRadius:0];

    UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(rect.origin.x,rect.origin.y,rect.size.width,rect.size.height)cornerRadius:radius];

    [path appendPath:circlePath];

    [path setUsesEvenOddFillRule:YES];

    

   fillLayer = [CAShapeLayer layer];

    

    fillLayer.path = path.CGPath;

    fillLayer.fillRule =kCAFillRuleEvenOdd;

    fillLayer.fillColor = [UIColor blackColor].CGColor;

    fillLayer.opacity =0.8;

    

    [self.layer addSublayer:fillLayer];

 

效果图:

技术分享

 

使用CAShapeLayer绘制镂空的图层

标签:

原文地址:http://www.cnblogs.com/envyhappy/p/5030008.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!