i have a scrollview which contains a pdfpage rendered with CATiledLayer, i want to draw stuff onto the pdf page so i created a overlay layer, i need the graphic to look vectorized so i decided to use CATiledlayer for the overlay layer. Only problem is that it is very slow to draw (I'm using beizerpath to draw), then i tried to optimize it by creating the overlay layer with the visible height and width when zooming in and out, so i don't need to create the overlay for the whole content bound. But still no luck , i want to try CALayer but the draw path just becomes blurry and pixelated, so i'm not sure how i can improve on this. I also tried drawinrect but for some reason it doesn't seem to work.
Asked
Active
Viewed 662 times
-1
-
Post some code that we can actually try, and be specific about one particular problem. As stated, your question is too vague to bother with. – Kurt Revis May 26 '12 at 17:19
1 Answers
1
I suggest not using bezierpath to draw annotations since it requires you to redraw the whole path every time the pen moves. It would be better if you draw only the current line segment using CGContextAddQuadCurveToPoint.
- At touchMoved, get the current point and 2 prev points
- Using those points, get the area where the line should be drawn
- draw at that area in drawRect using setNeedsDisplayAtRect
- inside drawRect, go to the end of your path and add your new line using CGContextAddQuadCurveToPoint

kssilvoza
- 11
- 2