I have a UITableView
(let's call it HomeVC) and when you press the cells it takes you to a details page via a show segue. On that details (DetailsVC) page, there is an edit button which modally brings up an edit view (EditVC) with a delete option. When the delete option is pressed, I want to go back to the HomeVC, "unwinding" (if that's the correct term) the EditVC and DetailsVC.
Right now my delete button (in EditVC) brings up an ActionSheet
to confirm deletion with the destroy(delete) button doing:
let destroyAction = UIAlertAction(title: "Confirm Delete", style: .Destructive) { (action) in
//handle deletion stuff...
// send user back to HomeVC
self.dismissViewControllerAnimated(false, completion: nil)
//also tried self.parentViewController?.dismiss...
}
The dismissViewController
works to get rid of the modal segue from DetailsVC to EditVC, bringing me back to DetailsVC, but since this item is now deleted I don't want to see its details, I want to go all the way back to HomeVC. How could I accomplish this? Can I do it all from EditVC in the function above?
EDIT: If you're coming here from search/google, this is what I used to finally get it: https://stackoverflow.com/a/27879562/2868510