views:

202

answers:

2

I have a PDF reader that displays pages of the document. What I want to do is allow the user to draw over the PDF in a transparent view. Then I want to save the drawing (UIImage) to disk. If at all possible, I don't want to have the documents folder filled with files like documentName_page01.png, documentName_page02.png for every page that is drawn over.

However, I can't figure out how to store these UIImages into a single file without it becoming unwieldy and memory intensive.

Any ideas appreciated.

+1  A: 

What is the user drawing, just lines, rectangles, circles and so on? Maybe store colors and paths of what needs to be drawn, put all of that into an NSArray and serialise that. That might be easier than trying to put multiple UIImages into a file, will use up less space on the device, and might be faster to load. Then just recreate the drawings.

Thomas Müller
Yes, that was another option. Thank you. I may just try and see if I create one folder per "master file" and store the related files in that folder so that it least looks less cluttered. I kind of wanted to keep the images in one file, but I have no idea how many images the user might create. Thanks.
aron
Thomas,That's what I ended up doing. I saved the drawing events.Thank you.
aron
A: 

Use Core Data to store your images in Binary Data fields and retrieve them from there. This way, you won't fill your Documents folder with images, no matter how many PDFs of how many pages you have. Here's a tutorial showing you how to do this.

luvieere
Thank you. I was taking a look at Core Data, it looks so powerful, maybe too much. I will check it out.
aron