Reputation: 187
I have a UITabBarController with 2 tabs (map & tableView) like the image below.
the problem here i need by pressing the refresh button the tabBar refresh/reload the current tab if it is the map, so refresh the map, if it is the tableView, so refresh the tableView.
just like for the first time when the tabBar instantiate the first tab at the beginning of launching the tabBar.
//i need something like that
self.currentTab.reload()
Upvotes: 1
Views: 1715
Reputation: 1133
Create a function which contains refresh related code for all the required components and whenever the reload button is clicked then call this function for current view controller. Initially call this function in viewDidLoad()
. If every time you navigate to this view controller and you need refreshed data then call this function in viewWillAppear()
Hope this helps.
Upvotes: 1