Reputation: 1773
I have a modal appear when a table view cell is clicked, when I close the modal and switch to another tab, and come back to the first tab I see a black screen. If I tap another tab without ever clicking on a cell and come back to the initial tab black screen does not show. I am assuming that the error occurs in how I present it or how I remove the modal view.
self.parentNavigationController?.addChildViewController(modal)
self.parentNavigationController?.view.window?.addSubview(modal.view)
modal.didMove(toParentViewController: self.parentNavigationController)
To remove the modal I just simply do self.view.removeFromSuperview()
Upvotes: 0
Views: 368
Reputation: 11112
You need to call other function too when removing the modal view
modal.willMove(toParentViewController: nil)
modal.view removeFromSuperview()
modal.removeFromParentViewController()
Upvotes: 1