views:

56

answers:

2

I would like to fill an array from a file every time one of my tableview's is selected in the tab bar.

I dont think putting the code in the viewDidLoad method works, because the view gets loaded on once?

Where should the code be placed?

Within the viewDidAppear method?

+2  A: 

You can conform to the UITabBarDelegate protocol and implement the following method:

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item

I suggest that you set the tag property in the creation of your UITabBarItems in order to differentiate between which tab the item is.

Jacob Relkin
I will use the viewWillAppear method thanks
alJaree
+2  A: 

Put it in viewWillAppear if you want the code to run before the view is displayed.

Avalanchis
Nice1. appreciate it.
alJaree