Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMalthe Pedersen
2,338 PointsRefresh data when dismissing viewcontroller
I have a viewcontroller which leads to another viewcontroller with modal presentation. When I dismiss this modal viewcontroller, I want to refresh the data being displayed in the first viewcontroller. How can I do that?
5 Answers
Dominic Bryan
14,452 PointsIn your prepare for segue add self.tableView.reloadData(), of course replacing the necessaries such as tableView with the name of your view you are going to.
Hope this gives you an idea.
Dom
Malthe Pedersen
2,338 PointsSo you're telling me that it is not possible to update/refresh/reload a viewcontroller??
Dominic Bryan
14,452 PointsHaha absolutely not, I didn't say that at all you just need to reloadData() in your segue method. What makes you say I said it wasn't possible aha
Dom
Malthe Pedersen
2,338 PointsBecause you said I needed to use a tableview instead :-)
Dominic Bryan
14,452 PointsNo no no I said "replace the necessaries such as tableView", so you would use view. reloadData() or what ever your view is called aha
Dom
Malthe Pedersen
2,338 PointsAhhh okay :-) The only thing I can do with reload, is this: self.view.reloadInputViews() ?
Malthe Pedersen
2,338 PointsIt didn't work btw.. This is my "prepare for segue" since its a modal; self.dismissViewControllerAnimated(true, completion: nil)