• 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: CustomView outlet is always (null)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CustomView outlet is always (null)


  • Subject: Re: CustomView outlet is always (null)
  • From: Troy Stephens <email@hidden>
  • Date: Mon, 27 Oct 2003 14:28:52 -0800

On Oct 27, 2003, at 1:57 AM, Oliver Donald wrote:
...
So I put a new 'IBOutlet ID *sceneView' into my sceneDescription object. I
loaded up InterfaceBuilder, made it read the new header for
sceneDescription, and the little exclamation mark appeared in it's
instantiation icon as expected. I subclassed NSView, called it
RTIGSceneView. I then put a CustomView in my window, set it's Class to
RTIGSceneView, and the change was reflected in the window. Then I control
dragged from my destinationless sceneView object to the CustomView (now a
RTIGSceneView) and connected my sceneView outlet to the RTIGSceneView, and
the exclamation mark disappeared. Saved, compiled and ran. But the
CustomView never recieves any messages sent from sceneDescription, and the
sceneView outlet is always '(null)'.

How do I give sceneDescription access to the CustomView?

What you're doing sounds correct in general.

How are you loading the window that contains the custom view? Is it part of your application's main .nib file? Or are you writing an NSDocument-based application, with your sceneDescription object as the File's Owner (perhaps?) for a document .nib that the app loads when opening the file?

All of your sceneDescription object's outlets should be set at the point where it receives an -awakeFromNib message. If yours is a document-based application, you should wait until your NSDocument subclass (which I imagine might be your sceneDescription class) receives -windowControllerDidLoadNib: before counting on its outlets being set up.

I'm not sure about
terminology, but I'm guessing that sceneDescription is the data-source for
CustomView and that I've got something backwards.

There's no specific terminology for connecting a controller or other object to a view. NSTableView and NSOutlineView use the term "dataSource" to denote a certain kind of functional relationship between the view and a delegate object, but terminology aside it really just boils down to an outlet that gives one object a pointer to another... If your sceneDescription object has a need to message your CustomView object, then providing a "sceneView" outlet in the sceneDescription instance is appropriate. If you also need to be able to message in the other direction, you may want an corresponding outlet in the CustomView instance to make that connection as well.

Troy Stephens
Cocoa frameworks, Apple
_______________________________________________
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.

References: 
 >CustomView outlet is always (null) (From: Oliver Donald <email@hidden>)

  • Prev by Date: Re: Double messages
  • Next by Date: Re: Smaller Application?
  • Previous by thread: CustomView outlet is always (null)
  • Next by thread: Re: CustomView outlet is always (null)
  • Index(es):
    • Date
    • Thread