views:

33

answers:

2

Hi, does anyone know if it's possible to cache the entire UIView on a drive not in memory so you don't have to regenerate the entire content everytime you want to access it ... Right now I am preloading three pages on both sides in scroll view but it would be nice to pregenerate the entire edition in background and store it in documents directory.

A: 

If the view is static then you may save it as image.

Michael Kessler
unfortunately it's not, user has to be able to zoom in and interact with the view, I am already using this on pages with static ads ...
Ondrej
+1  A: 

Have a look at Erica Sadun's developer cookbook pages 311-316 on adding persistence to direct manipulation interfaces and in particular, persistence through archiving which does exactly what you are wanting.

The core of this is use of NSKeyedArchiver and NSKeyedUnarchiver which will let you persist an object into a file.

I haven't done this myself yet, but I remember reading it at the time and thinking it could be very useful for exactly your situation.

Roger
Anyone has some experience with performace on iPhone / iPad / iPod? ... I'll do some tests and post them as well ...
Ondrej
Unfortunately it somehow?! stores the object but that one is going trough some strange initialization procedure when called from file ... it looks like you can just store objects but without values?!
Ondrej