gpt4 book ai didi

Swiftui 图形虚线闭合

转载 作者:行者123 更新时间:2023-11-28 13:12:49 27 4
gpt4 key购买 nike

这是我的代码:

UIGraphicsBeginImageContextWithOptions(CGSizeMake(self.view.frame.width,graphSize), false, 0)
let context = UIGraphicsGetCurrentContext()
CGContextSetStrokeColorWithColor(context, UIColor.whiteColor().CGColor)
CGContextSetLineWidth(context, 0.3)
CGContextBeginPath(context)
CGContextMoveToPoint(context, width1, height1)
CGContextAddLineToPoint(context, width11, height11)
CGContextMoveToPoint(context, width2, height2)
CGContextAddLineToPoint(context, width22, height22)
//dash line
CGContextStrokePath(context)
CGContextMoveToPoint(context, width3, height3)
CGContextAddLineToPoint(context, width33, height33)
CGContextSetLineDash(context, 0, [4], 1)
//next lines...
CGContextMoveToPoint(context, width4, height4)
CGContextAddLineToPoint(context, width44, height44)

我想在 width3 和 height3 上有破折号,但我的下一行也是破折号..如何停止要执行的破折号?

最佳答案

你可以像这样重置上下文:

CGContextSetLineDash(context, 0, nil, 0)

关于Swiftui 图形虚线闭合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30669103/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com