0

Currently running into an issue where I am trying to update my view after using a show segue to a separate popup view. The initial viewDidAppear is being triggered on load, but after i close out of my other view and transition back to the other view, it is not reloading.

I'm looking for an option to either trigger a reload of my data, or to try and refresh the information on a view being closed.

chrono
  • 83
  • 1
  • 8
  • You can use [unwind segue](http://stackoverflow.com/a/15839298/5163639) in this case. – Onur Jun 19 '16 at 19:09
  • I'll take a look at this one a little bit later today. Thanks for the suggestion, hopefully this works. – chrono Jun 20 '16 at 13:16

2 Answers2

0

When you close out of the view controller, are you dismissing it or performing a new segue. If you are just performing a new segue, then the view controller would have already been loaded. You would need to use this function:

override func dismissViewControllerAnimated(flag: Bool, completion: (() -> Void)?) {

}
Pete
  • 84
  • 10
  • I'm using a show segue so i'm using a `self.view.window?.close()` in order to close out that window once the button is clicked. Its also in a different file where that class is held. So is there any way of detecting a window closing from a different class? I've been searching for a way to detect a closing view controller and use that as a trigger – chrono Jun 20 '16 at 12:25
0

Try calling the reloadData() method on the tableview IBOutlet from within the button being clicked to segue to the viewController.

for Ex:

@IBAction func segueButton(sender: AnyObject) {

tableView.reloadData()

}

nodyor90z
  • 312
  • 2
  • 4
  • 13
  • Unfortunatley its not a tableView that i need refreshed, its a text field. I would use the reload data on the button however due to the field i need populated it wont work. – chrono Jun 20 '16 at 12:20