0
По какой-то причине, при попытке создать линию с закругленными углами, все другие свойства применяются рядом с этим дваCGContextSetLineCap/CGContextSetLineJoin игнорируется при создании ImageContext
UIGraphicsBeginImageContextWithOptions(size, opaque, scale)
let context = UIGraphicsGetCurrentContext()
CGContextSetStrokeColorWithColor(context, color.CGColor)
CGContextSetLineCap(context, CGLineCap.Round) //Ignored
CGContextSetLineJoin(context, CGLineJoin.Round) //Ignored
CGContextSetLineWidth(context, lineWidth)
CGContextSaveGState(context)
CGContextMoveToPoint(context, bounds.midX, 0)
CGContextAddLineToPoint(context, bounds.midX, bounds.maxY)
CGContextRestoreGState(context)
CGContextStrokePath(context)
// Drawing complete, retrieve the finished image and cleanup
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
Результат:
Любые предложения? Спасибо!
Как кажется, ваша линия простирается на весь диапазон y-координат (0 .. bounds.maxY), поэтому любые штрихи строк будут * вне * границ. –
@MartinR, Yap. Благодарю. Можете ли вы отправить ответ, чтобы я принял его? –
@JanGreve, Done :) –