Hate to be a pest, but had to throw this one up again in case it got lost over the holiday. I figure drawing offscreen with subviews created in IB has got to be common enough that someone would know the right strategy. I can do what I want with [NSString drawAtPoint:withAttributes:] but that seems a lot of unnecessary layout work when I can do it all in IB. (Unless it's significantly more efficient?)

I guess I just don't understand why an NSView will draw all its subviews to screen, but when I try doing it offscreen into a file, the subviews won't draw without a lot of work. Any advice is appreciated.

John


On Dec 23, 2008, at 9:56 AM, John Kestner wrote:

I've got a custom NSView that displays a visualization and some subviews that I placed using Interface Builder that overlay some text. This is used as a secondary window that updates when I select a name from a list in the primary window, and that works great. And it's easy enough to save the current visualization as an image.

Now, I have a Save All Visualizations command that attempts to create an offscreen instance of this custom view and iterate through all the names, placing the appropriate dynamic text in the subviews and saving each in turn. The visualization gets captured in the image, but the text in the subviews does not. I'm currently using dataWithPDFInsideRect, but I've also tried creating an offscreen NSBitmapImageRep, stuffing it in a new graphics context and running drawRect on my custom view.

Do I need to ditch IB and programmatically addSubview for each text field? I've wracked my brain and the archives trying to figure out this one. It may be that my understanding of NSView is poor.

Thanks,
John
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please 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/jkestner%40media.mit.edu

This email sent to [email protected]

--
Bounty Hunter / Research Assistant
Information Ecology, MIT Media Lab
http://web.media.mit.edu/~jkestner

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please 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/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to