How to avoid NSCachedImageRep

I am working with NSImage which comes from PDF. When I initially create the image, it only has one NSImageRep and that is NSPDFImageRep. It's good. I can work with him. I can find out how many pages it has and go to the specified page and draw it, etc.

The problem is that as soon as I turn my back, it turns into NSCachedImageRep, which doesn't seem to have multiple pages. Now if I store the PDFImageRep in a separate variable, it is tracked, but it is no longer associated with the image, so when I draw the image it is still on the same page.

What am I missing?

thank.

+2


source to share


2 answers


You need to call [image setDataRetained: YES] on the image for your original PDF data to be saved, otherwise it will be cached into a bitmap.



If you still have problems, you can disable caching completely using [image setCacheMode: NSImageCacheNever].

+2


source


Try 10.6. The problem has probably evaporated.



For details on the NSImage changes, see the AppKit Release Notes .

0


source







All Articles