views:

308

answers:

1

Hi,

my app features a UITabBarController, which brings up some views. In the AppDelegate, I have to pass a (custom) model to it. Is the best way subclassing, or is there some better method?

If I get it managed to have the model (e.g. Notes) in my UITabBarController, how do I access it out of the ViewControllers?

Regards

+1  A: 

I'm not really sure why you would want to pass a different model to the UITabBarController. The only thing tab bar controllers do really well is managing the tab bar. Their "model" is basically a list of ViewControllers which they then present to the user if he taps a tab bar icon.

In the documentation Apple says the UITabBarController class is not intended for subclassing, but you could still do this if it were neccessary.

But if you just want to do this because you have convenient access to the tab bar controller from within your other view controllers, then I'd recommend leaving the tab bar controller allone and implementing some sort of a NoteManager class (probably as a singleton) and simply using it from your other view controllers.

mh0rkk
Thanks for your view and hints! Didn't know, that Apple says UITabBarController is not intented for subclassing. I will do the singelton approach.
Stefan