CAShapeLayer * shape = [CAShapeLayer layer];shape.frame = CGRectMake((CGSSize().wIDth/2.f)-40.f,-40.f,80.f,80.f);CGPathref pathref =CGPathCreateWithEllipseInRect(CGRectMakeBoundsWithSize(shape.frame.size),NulL);shape.path = pathref;shape.fillcolor = [UIcolor bluecolor].CGcolor;self.layer.mask = shape;解决方法 是的,kCAFillRuleEvenOdd在没有首先添加rect的情况下没有做到这一点,这里有一个工作片段:
CAShapeLayer *shape = [CAShapeLayer layer];shape.frame = self.bounds;CGMutablePathref pathref = CGPathCreateMutable();CGPathAddRect(pathref,NulL,self.bounds);CGPathAddEllipseInRect(pathref,self.bounds);shape.fillRule = kCAFillRuleEvenOdd;shape.path = pathref;self.layer.mask = shape;总结
以上是内存溢出为你收集整理的ios – CALayer创建透明圆形面具全部内容,希望文章能够帮你解决ios – CALayer创建透明圆形面具所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)