PDFPage initWithImage:奇怪的行为

时间:2011-01-10 17:17:41

标签: objective-c nsview pdfpage

我无法理解其中的区别。它接缝是相同的但不是!

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];

1 个答案:

答案 0 :(得分:0)

以下是解决方案:

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