2011-01-10 54 views
0

我無法理解區別。它接縫是相同的,但不是!PDFPage initWithImage:奇怪的行爲

enybody知道爲什麼嗎?

// Working: 
PDFPage *imagePDFPage = [[PDFPage alloc] initWithImage: 
[[NSImage alloc]initWithContentsOfFile:imagePath]]; 


// NOT Working: 
NSImage *image = [[NSImage alloc]initWithContentsOfFile:imagePath];       
PDFPage *imagePDFPage = [[PDFPage alloc] initWithImage:image]; 

回答

0

這裏的解決方案:

NSImage *image = [[NSImage alloc]initWithContentsOfFile:imagePath]; 
PDFPage *imagePDFPage = [[PDFPage alloc] initWithImage:(CIImage *) image];