I have an UITabBarController(empty) which have 2 subView. These two subView are tableView(get data from database). I want to refresh view every time when a tab bar item is clicked(get new data from DB).
I search many method on Internet. Some said use the viewwillappear. But did work.
Can anyone give me some Suggestions？ Thanks
Best How To :
You set something to be the tab bar controller delegate and when the user clicks on a tab bar item, override:
and each time the item is touched, send a message to the view controller (which is one of the parameters that comes in via that delegate method) to refresh whatever you want.
Don't use "
viewWillAppear". That's meant to be called right before the view is meant to appear.
I'd suggest implementing a custom "
refreshView:" method (or you can choose whatever method name that makes sense to you) and inside there, do whatever UI refreshing you want to do for the view owned by that view controller.