1

I'm using UITabbarController in my project. All viewControllers are loading properly and the navigation from parentViewController in UITabbarController to a childViewController and then back to parentViewController when tabbaritem is tapped is working.

Now I want to reload the parentViewController if the user tap on the UITabbarItem while the parentViewController is already visible.

I'm not using and don't want to use viewwillappear method to reload the viewcontroller which will not work here in this case anyways as the view is already visible.

Joe
  • 173
  • 1
  • 15
  • both. In one case i want to reload the UIViewController data and in other just some UITableView. Or just simply trigger a function when tabbar item is tapped again. – Joe Jan 24 '20 at 12:33
  • yes that makes more sense. create a function that will be called when the tab bar button is tapped. and make all layout changes or table view changes from there. – Keshu R. Jan 24 '20 at 12:34
  • https://stackoverflow.com/a/40565670/8374890 here is your answer – Keshu R. Jan 24 '20 at 12:36
  • Yes I've all the functions ready but can't figure out how to trigger and reload. I'm using storyboard to create UITabbarController. now don't understand what delegate methods i can use to detect tap on the same tabbar item. – Joe Jan 24 '20 at 12:37
  • 1
    @KeshuR. Thanks, I'll try this solution and update. appreciate your help. – Joe Jan 24 '20 at 12:39
  • Does this answer your question? [Detect when a tab bar item is pressed](https://stackoverflow.com/questions/33837475/detect-when-a-tab-bar-item-is-pressed) – Keshu R. Jan 24 '20 at 12:49
  • @KeshuR. yes it detects the second tap in same viewcontroller, but now there is another issue. In parentViewcontroller with childViewControllers, tapping on the tabbarItem navigate back to parentViewController from childViewController and triggers reload but i want to reload the data only if the parentViewController itself was visible when tabbarItem was tapped again other wise simply navigate back to parentVC from childVC. – Joe Jan 26 '20 at 14:03
  • thanks for the answer. I'll do some further googling for this new issue. – Joe Jan 26 '20 at 14:05

0 Answers0