loadNibNamed information for the list archives
loadNibNamed information for the list archives
- Subject: loadNibNamed information for the list archives
- From: j o a r <email@hidden>
- Date: Tue, 17 Jul 2001 00:14:26 +0200
All right. Experienced Cocoa-users don't need to read this...
This was not the first time I wasted a couple of hours trying to figure
out why my nib weren't loading...
This email is for all the newbies out there, and for myself, the next
time I forget about this and tries to find something in the list
archives.
When you break up a nib file and tries to load it in a subclass you need
to select a new filesOwner in Interface Builder. It defaults to NSApp,
and should be set to the class of the object you are loading it into. If
you don't, the nib will still load fine, "loadNibNamed" will return YES
(a little bit strange if you ask me), but you will never - never -
populate your instance variables with the stuff from the nib. Trust me
on this one...
Solution:
Make sure that you have a representation of your class in the nib - you
don't need to instantiate it - and in the Custom Class pane of the
Inspector, select that class as the Custom Class.
Now, instead of connecting your IB objects to an instance of your class,
connect them to the owner of the class.
Regards and lots of DOH!
j o a r