1


I have a UITabBarController with 2 tabs (map & tableView) like the image below. enter image description here
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()
2
  • 1
    You won't find a view controller refresh mechanism because there isn't one. And there doesn't need to be one because reloading an entire view controller just to reload certain components is not efficient. It's on you to reload the data and/or subviews that need reloading. Commented Jun 8, 2019 at 4:22
  • 1
    You may also want to apply the bottom safe area to that tab bar if that's not done on purpose. Commented Jun 8, 2019 at 4:25

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

How about an example? How do you access the children viewcontrollers or fragments from the tab controller?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.