deriving from NSTabViewItem

Posted by Jonny on Stack Overflow See other posts from Stack Overflow or by Jonny
Published on 2010-01-27T07:37:17Z Indexed on 2010/03/31 7:03 UTC
Read the original article Hit count: 540

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nstabview