Search code examples
iosdrawinguibezierpath

UIBezierPath round edges?


Im drawing some lines and I noticed that when the edges get at a certain angle it generates a sharp edge like this: pointy edge

What I want it to draw: round edge

How do I do this? I have looked through the documentations but I dont seem to find anything im looking for. Or is there a way to turn that auto-edge-generating off?


Solution

  • UIBezierPath's have a property called lineJoinStyle. Set it to kCGLineJoinRound and it will draw as you want it.

    UIBezierPath *myPath = ...
    myPath.lineJoinStyle = kCGLineJoinRound;