0

I have a UIView with lots of image is drawn from drawRect when drawn finished, i wanna save(cache) all of image

How to save(cache) all of image in drawRect or something like that!

Thank everyone for looking this article.

heaven
  • 221
  • 4
  • 19
  • Couldn't you just put the code in a separate method and call it whenever you need the rectangle drawn? – woz Nov 21 '12 at 02:51
  • I add subview UIView with a lots of image inside uiscrollview when uiscrollview scroll i call uiview again, because uiview will be redraw image, i don't want redraw image – heaven Nov 21 '12 at 02:57

1 Answers1

0

If you cache blindly in the name of performance, it can have very negative performance costs. Caching isn't free -- use it judiciously in order to achieve the best balance of resources. Ideally, you would consider several other alternative approaches to determine which suits your exact needs best.

One quick/efficient approach would be CALayer.shouldRasterize.

justin
  • 104,054
  • 14
  • 179
  • 226