绘图圆没有填写IOS

绘图圆没有填写IOS,第1张

概述我正在使用这段代码在UI ImageView中画一个圆. CAShapeLayer *circleLayer = [CAShapeLayer layer];// Give the layer the same bounds as your image view[circleLayer setBounds:CGRectMake(0.0f, 0.0f, [photoView bounds].siz 我正在使用这段代码在UI ImageVIEw中画一个圆.
CAShapeLayer *circleLayer = [CAShapeLayer layer];// Give the layer the same bounds as your image vIEw[circleLayer setBounds:CGRectMake(0.0f,0.0f,[photoVIEw bounds].size.wIDth,[photoVIEw bounds].size.height)];// position the circle anywhere you like,but this will center it// In the parent layer,which will be your image vIEw's root layer[circleLayer setposition:CGPointMake(coordsFinal.x + 130,coordsFinal.y + 200)];// Create a circle path.UIBezIErPath *path = [UIBezIErPath bezIErPathWith@R_404_6631@InRect:                      CGRectMake(0.0f,50.0f,50.0f)];// Set the path on the layer[circleLayer setPath:[path CGPath]];// Set the stroke color[circleLayer setstrokecolor:[color CGcolor]];// Set the stroke line wIDth[circleLayer setlinewidth:2.0f];// Add the sublayer to the image vIEw's layer tree[[photoVIEw layer] addSublayer:circleLayer];

我希望圈子是空的,只有边界.如何清除填充?

解决方法 将填充颜色设置为透明(Alpha 0)
[circleLayer setFillcolor:[[UIcolor colorWithWhite:0 Alpha:0] CGcolor]];

AKA …

[circleLayer setFillcolor:[[UIcolor clearcolor] CGcolor]];

(谢谢Zev)

总结

以上是内存溢出为你收集整理的绘图圆没有填写IOS全部内容,希望文章能够帮你解决绘图圆没有填写IOS所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1108523.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存