That’s a really strange bug! Yes, definitely an iOS bug because when you call the other version of the method, it just doesn’t call CGContextStrokeLineSegments, and instead uses a path to draw it.
But looking at the code, it’s really odd that it could get it wrong like that… I’m at a loss for how we could change the native call to not trigger this crazy bug, so will just avoid using CGContextStrokeLineSegments and always draw the line as a path. I doubt whether that will be make much difference in performance, and TBH drawLine is probably best avoided anyway.
And since we have suggestions here on how best to draw it, it’s worth noting that the fastest (and actually least ambiguous over where exactly how the end of a 1-pixel line should be rendered) way to draw multiple vertical lines is with fillRectList.
drawLine is probably the worst way to do it, fillRect is better but if you’re doing more than one line, fillRectList avoids the significant overhead involved in making each call into the graphics stack and doing clipping etc for each rectangle. drawVerticalLine is simply a wrapper around a call to fillRect and only exists for backwards compatibility with the old days before scalable graphics made it pointless to have any operations that are optimised for 1-pixel 1:1 scale drawing.