In most of the samples the return value from loadNibNamed
value is not used, so I guess it's using the owner argument. But how does it work and make the connection to the owner object? What kind of requirements should my owner class meet in order to load a nib in such way?
The only requirements I can guess is that
loadNibNamed
can be set to self
Am I right in my assumptions or is there anything else I have to consider while using loadNibNamed
?
You have a basic understanding of what is required, though you should also consider memory management (which is slightly different for iPhone versus Mac). To really understand what is going on with this method, you should read the Nib Files section of the Resources Programming Guide. It covers the actual methods used to make the connections (which can be important), and the retain counts that various objects will have when it is done. Again, these are all slightly different between Mac and iPhone. iPhone has generally improved the consistency of how nib objects are handled.
For good measure, I always recommend that people read Memory Management of Nib Objects from the Memory Management Programming Guide. It's critical reading whether you use the lower-level methods or not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With