iphone – Update a tabView from within another tab? – Education Career Blog

I am having trouble with the tabBar:didSelectItem: in my app…
I have 4 tabs and 1 of them is a settings tab that updates a plist file with the settings on save.

What I want to do is to run an action, when another tabbar item is selected, so I can update the view with the appropriate settings. I just can’t get this to work. Can anyone please show me an example on how to use the tabBar:didSelectItem: in this way, or maybe another way to do it? Thanks…


here is a different way of achieving what you want.
In the following, I am assuming that your tabBarController has been instantiated in the delegate of your application, as usual.

// retrieve your delegate

mainDelegate = UIApplication sharedApplication delegate;

// retrieve selected tab

NSUInteger tab = mainDelegate.tabBarController selectedIndex;

// now do what you like on the basis of the tab selected by the user


case 0:

    // your stuff here



case N-1:

    // your stuff here



    // you should never arrive here if you check all of the possible values for the tab



This should be enough to achieve what you meant if I understood correctly.

Leave a Comment