Re: PDFView with a 'small' frame
Re: PDFView with a 'small' frame
- Subject: Re: PDFView with a 'small' frame
- From: Ricky Sharp <email@hidden>
- Date: Sat, 17 Sep 2005 21:12:11 -0500
On Sep 17, 2005, at 8:32 PM, Phil wrote:
I've noticed some strange behavior creating PDFViews
programatically (i.e. this doesn't seem to happen if I create the
PDFView in a window using IB which tells me something required is
not being set?) and am hoping someone will have some insight as to
what is missing.
It seems that if the frame size is small enough (in trying
different settings it appears that this is just about any value
smaller than the size of what PDFPage boundsForBox: returns for the
height or width), then the PDFView will go into a state of constant
refresh or will remain grey and go to 100% CPU utilization. Here's
a code snippet to create the PDFView as subview which illustrates
the problem:
PDFDocument *newDoc;
PDFView *thispdfview;
NSURL *theURL;
theURL = [NSURL fileURLWithPath: @"<PDF filename>"];
newDoc = [[PDFDocument alloc] initWithURL: theURL];
// NSRect myRect = { { 0,0 }, { 150, 200 } }; // this doesn't
work so well
NSRect myRect = { { 0,0 }, { 700, 900 } };
thispdfview = [[PDFView alloc] init];
[thispdfview setDocument: newDoc];
[thispdfview setFrame: myRect];
[thispdfview goToPage: [newDoc pageAtIndex: 0]];
[self addSubview: thispdfview];
This form works as expected. However, if you replace the NSRect
definition with the commented version the issue is observed.
You should be using the appropriate designated initializer for your
PDFView. And, because that class doesn't provide any, you'll need to
use the one for its superclass (initWithFrame:).
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden