Reputation: 9781
I'm trying to understand how the CGContextMoveToPoint function works. Basically, I have a CGPath that I want to draw multiple times at varying y offsets. To do so, I thought I'd use the same CGPath reference and just move the entire context. Drawing the path works great. However, when I use CGContextMoveToPoint(context, 0.0, 100.0)
the path doesn't move 100px down like it is supposed to. Adding the line doesn't change anything at all.
What am I doing wrong?
Upvotes: 0
Views: 3048
Reputation: 6405
The coordinates you specify, for example in CGContextAddLineTo, is an absolute point not a relative point to the previous point. The best way of moving the entire path, is to translate the coordinate system itself (CGContextTranslateCTM) and draw the path there (and revert the system if needed).
Upvotes: 3