FROM : James Bucanek
DATE : Thu Jun 08 22:24:31 2006
Karim Morsy wrote on Thursday, June 8, 2006:
>if a single instance is the files owner for multiple nib files it
>gets sent awakeFromNib each time one of the nibs is loaded.
>how can I determine in awakeFromNib which nib file this method was
>called for ?
As far as I know, you can't. The awakeFromNib message carries no contextual information.
However, it should be implied since it's probably your code that's loading on of the "other" NIBs, so you should be able to tell your object which NIB is about to be loaded prior to loading it.
The ideal solution, of course, would be an awakeFromNib handler that didn't need to know and would perform the correct initialization or do nothing as appropriate. Stateless handlers are always preferable, when possible.
--
James Bucanek
DATE : Thu Jun 08 22:24:31 2006
Karim Morsy wrote on Thursday, June 8, 2006:
>if a single instance is the files owner for multiple nib files it
>gets sent awakeFromNib each time one of the nibs is loaded.
>how can I determine in awakeFromNib which nib file this method was
>called for ?
As far as I know, you can't. The awakeFromNib message carries no contextual information.
However, it should be implied since it's probably your code that's loading on of the "other" NIBs, so you should be able to tell your object which NIB is about to be loaded prior to loading it.
The ideal solution, of course, would be an awakeFromNib handler that didn't need to know and would perform the correct initialization or do nothing as appropriate. Stateless handlers are always preferable, when possible.
--
James Bucanek
| Related mails | Author | Date |
|---|---|---|
| Karim Morsy | Jun 8, 20:49 | |
| James Bucanek | Jun 8, 22:24 |






Cocoa mail archive

