views:

9

answers:

0

I have a TabBar with 4 tabs, 2 of the tabs are the same class, and come from the same nib, and will only made different by the parameter they are passed.

However I can not work out how to do this parameter passing, since the init'ing and switching of these views are done automatically by the tabbar controller.

I can think of a few ways to do this. I could set the parameter in the tarbar controllers viewDidLoad method, but are the child views allocated correctly at this stage in the life cycle?

Or I could use tabBarController:didSelectViewController: and set the required parameter the first time the controller is selected.

Or I could have the data flow the other way, and get the viewcontroller to ask the tabbar controller what is should be when it loads (but then if I use the view without a tabbar later, it needs to be refactored)

What is the correct way to do this?