1

I am working on a swift iPhone application that loads a website page on viewDidLoad() function but I am stumped and have not been able to figure this next part out.

Basically what I am trying to do:

The dashboard controller (tab format) connects to three different pages which the first time you click on the tab it loads the page correctly via the viewDidLoad()

However when I go to a different tab then click back I need it to reload except it doesn't run the viewDidLoad() function again to load it.

Is there a function I can access or call? I have looked through app documents but I have failed to find it.

Thanks so much for the help!

user5600884
  • 119
  • 1
  • 8

2 Answers2

2

You can use below view life cycle delegate method:

As per my understanding reloading a Webpage is not a UI update, So if you will use viewWillAppear so it will call before viewDidAppear which helps you to request faster.

override func viewWillAppear(animated : Bool)
{
  super.viewWillAppear(animated)
}
Dheeraj D
  • 4,386
  • 4
  • 20
  • 34
0

Sounds like you are looking for viewDidAppear, which likes like the following in Swift 3 ...

override func viewDidAppear(_ animated: Bool){
    super.viewDidAppear(animated) //call superclass's implementation first

    //do stuff here ie. reload() 
}
MikeG
  • 3,745
  • 1
  • 29
  • 51