• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Saving unseen NSView with subviews to NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving unseen NSView with subviews to NSImage


  • Subject: Re: Saving unseen NSView with subviews to NSImage
  • From: John Kestner <email@hidden>
  • Date: Mon, 29 Dec 2008 16:02:38 -0500

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@hidden)

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:
This email sent to email@hidden

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

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Saving unseen NSView with subviews to NSImage
      • From: "I. Savant" <email@hidden>
References: 
 >Saving unseen NSView with subviews to NSImage (From: John Kestner <email@hidden>)

  • Prev by Date: Re: Pull Down Toolbar Item
  • Next by Date: Re: Pull Down Toolbar Item
  • Previous by thread: Saving unseen NSView with subviews to NSImage
  • Next by thread: Re: Saving unseen NSView with subviews to NSImage
  • Index(es):
    • Date
    • Thread