Re: PDFView won't display the first time?
Re: PDFView won't display the first time?
- Subject: Re: PDFView won't display the first time?
- From: John Calhoun <email@hidden>
- Date: Tue, 27 Mar 2007 18:32:48 -0700
On Mar 27, 2007, at 5:40 PM, Nick Zitzmann wrote:
NSData *pdfData = [myView dataWithPDFInsideRect:[myView frame]];
PDFDocument *document = [[[PDFDocument alloc]
initWithData:pdfData] autorelease];
[pdfView setAutoScales:YES];
[pdfView setDocument:document];
[pdfView layoutDocumentView];
[pdfView setNeedsDisplay:YES];
The last two lines above are not needed since calling -[PDFView
setDocument:] will internally re-layout the document view and mark
itself dirty. Might as well remove those lines.
Otherwise, I don't see why you would get the gray view that you
describe. Are you sure that the PDFView (in your NIB) is instantiated?
Also, the -setAutoScales: option is ignored the first time, although
if I call this again with different PDF data, then it works.
On Tiger, I think this was a bug (as was pointed out) where you need
to call -[PDFView setDocument] before playing with the display
parameters like auto-scaling, etc.
Can we see more code? A small sample app would be nice to look at.....
Also, I have to ask, have you tried this on Leopard? FWIW, your code
probably works as is. Just curious anyway....
john calhoun—_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden