首页 > 其他 > 详细

使用CAShapeLayer绘制镂空的图层

时间:2015-12-08 20:09:10      阅读:220      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!