Re: Hiding superclass methods
Re: Hiding superclass methods
- Subject: Re: Hiding superclass methods
- From: email@hidden
- Date: Fri, 10 May 2002 09:20:05 -0700
I wrote
|Views loaded from nib files never have initializers called, not even
|initWithFrame:, so any code you might put there would be executed only
|if you created the view explicitly in your application.
|(Initialization of views loaded from nib files has to be done in
|awakeFromNib.)
Brock Brandenberg replied
|To make it clear to any newbies, though, the initWithFrame: method does
|get called on objects loaded from a nib file when the objects are
|instantiated in a content view or another superview.
No, initWithFrame: just isn't called. According to the Cocoa documentation, "the init and initWithFrame: methods are never called when a nib file is opened. As you create a nib file, Interface Builder automatically initializes its elements. When you later load that nib file, all its elements are already initialized." (in /Developer/Documentation/Cocoa/TasksAndConcepts/ProgrammingTopics/LoadingResources/Concepts/NibFileLoaded.html). My personal experience (including deliberate experimentation about just this question) supports this. AwakeFromNib is where objects (views or not) loaded from nib files must be initialized. (Granted, the documentation could be wrong. If it is, and initWithFrame: *does* sometimes get called for views loaded from nib files, I strongly encourage you to post a bug report about it, and, for my edification, could you describe an example that demonstrates initWithFrame: being called?)
|I'm assuming that you're referring to creating instances of
|NSViews by dragging them into the "Instances" tab of the main nib file
|window?
All my views have been created by assembling them into windows, dragging from the palettes into the window. I've never dragged anything directly into the "instances" tab. (I thought you could drag views only into windows. Can they be dragged into the "instances" tab?)
Glen Fisher
_______________________________________________
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.