jeudi 25 juin 2015

How to update Data in tableview using swift?

Currently I have 3 swift files: ManualViewController, AutoViewController, Main

ManualViewController is the UIViewController with a table view. AutoViewController is a UIViewController with a few buttons. Main is just a swift file with all the data for table view.

ManualViewController and AutoViewController are controlled using TabBarController.

When I run the app the initial contents found in Main.swift is loaded onto the table view. When I go to the next view i.e AutoViewController and click on a button to change data in Main.swift, the data changes. The problem is when I switch back to ManualViewController the table still contains the old data and not the updated one.

I also tried this:

override func viewWillAppear(animated: Bool) 
{
    super.viewWillAppear(false)
    self.tableView.reloadData()
}

It still din't work.

See more ..

Aucun commentaire:

Enregistrer un commentaire