How to know when a tabbar item that is in the superview is clicked from a sub view
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 us开发者_如何学编程er 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
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. `
精彩评论