• 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: Drawing hidden NSWindow to NSImage then to a NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing hidden NSWindow to NSImage then to a NSView


  • Subject: Re: Drawing hidden NSWindow to NSImage then to a NSView
  • From: Brian Webster <email@hidden>
  • Date: Mon, 12 Aug 2002 16:20:51 -0500

On Monday, August 12, 2002, at 03:47 PM, cocoa-dev-
email@hidden wrote:

In the initWithFrame method I have a
NSWindowController class. Using that class I'm trying
to initWithWindowNibName my NIB file but console is
reporting that it can't open the NIB file. Any
suggestions on this?

I believe that initWithWindowNibName: will look for the nib file in the main bundle. In the case of a screen saver, this will be the bundle for the screen saver application, not the bundle for your plugin. Also, an NSWindowController isn't really necessary, as you can just load up the nib file with your object as the file's owner. Just hook up an outlet to the window in the nib file and do:

[NSBundle loadNibNamed:@"MyWindow" owner:self]

The docs state that this method will first look in the bundle that contains the class for the argument passed as the owner, which in this case will be your screen saver view. Then you can just reference the window through whatever instance variable you hooked it up to as the outlet.

Also is my direction correct? If I can get my saver to
load the NIB will I be able to fill in the hidden
window's static text fields with custom text, "print"
the window to a NSData (as PDF), transfer this to an
NSImage and draw the NSImage to the screen saver?

This should work OK, although you should be aware that there can be differences between the way a view draws itself on screen and when it's "printed", e.g. some views don't show their selection, or other such quirks.

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: loadNibNamed instantiating too many of my objects
  • Next by Date: Re: AuthorizationExecuteWithoutPrivileges?
  • Previous by thread: Drawing hidden NSWindow to NSImage then to a NSView
  • Next by thread: NSTableView: lifespan of objectValueForTableColumn object?
  • Index(es):
    • Date
    • Thread