deriving from NSTabViewItem
- by Jonny
I'm writing a Cocoa app. One dialog has 3 tabs, some of the tabs needs more loading time, so I want to load them lazily. Since each Tab is a NSTabViewItem class, so I'm trying to derive from it and overriding its view property. In the view getter method, I use a ViewController to load a view and returns out. In Debugging, I found NSTabViewItem -view method is get called correctly, but after that NSTabView tries to set Initial FirstResponder and crashed with message:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'In -[NSTabViewItem setInitialFirstResponder:], the first responder must descend from the tab view item's view. (Item: Invalid responder: )'
I tried to override the -initialFirstResponder method to return a sub-view of my loaded view, but it still crashes the same place.
does anyone know how to get it work correctly? Also is it correct way to do this by deriving the NSTabViewItem?
thanks!
-Jonny