I'm currently building a tabbed iPhone application where each tab's view controller is an instance of UINavigationController
, and where every subcontroller of every one of the UINavigationController
instances is an instance of UITableViewController
. Ideally, I'd like to subclass UINavigationController
so that the controller for each tab is a subclass of UINavigationController that (in addition to having all the standard UINavigationController
functionality, obviously) serves as the datasource and the delegate for each of the table views associated with its subcontrollers. Trying to do this seems to break the basic UINavigationController
functionality in the subclass.
Seeing as Apple says in their iPhone documentation that one shouldn't subclass UINavigationController
, and things seem to break when one does, I'm wondering how I should go about extending UINavigationController's
functionality without subclassing, and generally speaking, how one should work around subclassing limitations when doing Cocoa development.
Thanks!
For reference, note that since iOS 6, UINavigationController can be subclassed legally.
This class is generally used as-is but may be subclassed in iOS 6 and later. UINavigationController Class Reference
Of course, that doesn't mean you always should. But you can.