Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [KIND OF SOLVED] Re: PDFView won't display the first time?




On Mar 28, 2007, at 2:50 PM, Nick Zitzmann wrote:


On Mar 27, 2007, at 6:40 PM, Nick Zitzmann wrote:

However, on the very first time -setDocument: is called, the view appears completely grey on the screen, meaning it's not displaying anything. If I use the zoom controls once, then the "document" appears but is completely blank. If I use them again, then and only then does the document display correctly. Also, the - setAutoScales: option is ignored the first time, although if I call this again with different PDF data, then it works.

What's going on here?

Well, now I know what's going on: The PDFView was inside a modal window. When the window was being displayed normally, the PDFView worked as expected. Once I made the window run as modal, then the above behavior appeared.


I'm going to get a sample app together and file a bug on this as soon as I've finished this message, but in the meantime, I need an alternate PDFView class, something like what iCal uses to do its print preview in its page setup window. Does anyone have suggestions? I'd like something that users can move around by dragging the mouse (e.g. "drag mode" in Preview) as well as being able to zoom in and out, and it needs to be able to work in a modal window...

This smells like the classic "something needs to happen in the main run loop but you're running the a modal run loop so it doesn't" sort of problem that is also seen with things like embedding a WebView (or using NSURLDownload) in a dialog.



So what you can try is rolling your own modal session (beginModalSessionForWindow:, etc...), and inside that loop add:


[[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow:0.1]];

(which works for WebViews)



Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures, fractals, art



_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >PDFView won't display the first time? (From: Nick Zitzmann <email@hidden>)
 >[KIND OF SOLVED] Re: PDFView won't display the first time? (From: Nick Zitzmann <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.