Search code examples
iosxcodeswiftviewdidload

Refreshing TableViewController


I have a two tabbed application, on the first page the user can enter names one at a time, on the second tab, the names are shown in a TableView. I have the code to add the names array to the tables in the ViewDidLoad() func, however, this means that once the user has visited the second tab, when they go back to the first and add more names, they are not shown in the list because the list was populated in ViewDidLoad(), and the tab has already been loaded.

What I am asking for is, what is the name of the func that lets me do this? Something along the lines of IsSelectedTab, but I can't find it.


Solution

  • You are looking for viewWillAppear or viewDidAppear, they are called every time before/after the viewcontroller is about to be visible.