Drawing CAShapeLayer with a big CGPath
I am creating a vector based drawing app, and being truly vector based I need to have a "limitless" canvas. So I have created the following structure:
UIVIew (canvas view)
|
CALayer (canvas container)
|
CAShapeLayer (the drawn shapes)
...
Each shape that has been drawn by the user is a CAShapeLayer with a CGPath assigned to it. When the user zooms out the container (say the container has a size of about 10000x10000 points) and draws a new shape I get the points in scale of 1 and th开发者_高级运维an assign a scale transform to the new CAShapeLayer (that`s the only way I found that works).
The problem is that in my app I can draw a connection between two objects, so I use a CAShapeLayer to draw the connection but when zoomed out (say the distance between two shapes is about 5000pts) I draw a line with two points which distance is about 5000pts as well. Doing that I think the springboard is restarted. I've read that CAShapeLayer caches only the pixels of the drawn path and maybe that's my problem. So I ask for your help guys because I ran out of ideas. Is there a different approach to doing these huge shapes drawing and easily operate with them.
Thank you in advance.
精彩评论