0

I have an application which has a tabbar to navigate through 5 views. I have a uitableview in one of these 5 views (my viewcontroller for this view is the table delegate).

Now I want to reload my table view every time the user goes to another view and comes back to this view using a method called reinitializeAndReloadTable however I don't know when to call it..

Is there a method which lets my view know that the tabbar item related in its superview has been reclicked?

Thanx

tiw

tiw
  • 535
  • 1
  • 6
  • 22

1 Answers1

0

From what I getting you want to know when you select specific tab ?

You can use this method. add this inside App delegate. it gets called everytime tab is clicked then you can look for the specific view controller index and reload table.

Create a BOOL here to identify other than tableview is clicked.. use it to call reload method.

` // Optional UITabBarControllerDelegate method

  • (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {

    if ((self.tabBarController.selectedIndex == 1) //put your code here. `

k-thorat
  • 4,873
  • 1
  • 27
  • 36
  • @TheAstra this means i will still have to handle this event in the super view of the view where my table is.. – tiw Feb 22 '11 at 16:20
  • I'm debugging it. It is interesting that my app never makes it to the didSelectViewController method :[ – tiw Feb 22 '11 at 17:06
  • I DID create this app through the template tabbar application on xcode btw. so it already creates the app as the delegate to uitabbarcontroller – tiw Feb 22 '11 at 17:07
  • I think the tabbar generated via IB doesnot know that it has my app as a delegate :( – tiw Feb 22 '11 at 17:26
  • I am accepting your answer. Plus one could want to take a look at this thread: http://stackoverflow.com/questions/1781037/didselectviewcontroller-of-tabbarcontroller-is-not-working – tiw Feb 22 '11 at 17:38