![]() | awakeFromNib got called twice for the ChangingView example in chapter 17 |
|
18 Sep 2011, 09:57
qiulang (2 posts) |
Hi all, I am not sure if this is correct but awakeFromNib got called twice for the ChangingView example in chapter 17. I added awakeFromNib to MyWindowController for those ChangeView examples, e.g. HelloApplication43 to HelloApplication45. I was quite surprised to see it got called twice b/c I was told that awakeFromNib should be called only once, right ? For those exmaples MyWindowController is created in MainMenu.xib, but we also add init to it. When I debug the code, I find the first call is triggered by [NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] by [MyWindowController init] And the second call I guess, of course is because MyWindowController is created in MainMenu.xib. So can someone cast some light on it ? Calling awakeFromNib twice does not feel right. Thanks a lot! |
|
21 Sep 2011, 06:56
qiulang (2 posts) |
I further modified the window xib file to set its file owner to be NSApplication instead of MyWindowController. But awakeFromNib was still called twice! I am really confused now. Ant idea ? |
| You must be logged in to comment |

