CAShapeLayer vs UIView subview float values

I come across an issue as I have wanted to draw lines in a grid format. My first approach, drawing a UIBezierPath in a CAShapeLayer.

My issue is the resultant fuzziness on the lines, as they need to be located in floating values. Which makes actually sense that the lines are fuzzy. What I didn’t expect is that, if I use UIViews and position them on the exact same points as the Bezier points, I don’t get this fuzziness (see screenshot. UIView must be doing this correction somehow, don’t remember if in AS3 this was the case… but I am pretty sure even Views had to be on the integer value to avoid this.

graphs

I most likely will get the same result as the UIView, rounding up or down the floating values.

Leave a Reply

Your email address will not be published. Required fields are marked *