Reputation: 99
I get a black screen when returning to a view controller from a different tab.
I have the following flow:
The goal for the above setup was to always have the tab bar presented even though the rewards viewcontroller was presented modally. This works so far. The tab bar is indeed always visible, and I can alternate between the Points and Rewards viewcontrollers by pressing the Points and Rewards buttons respectively. I can also tab to other tabs as needed.
However, I get a black screen when I do the following:
I somewhat understand why the screen goes black. However, is there a way to reload and reset an entire viewcontroller when a tab button is pressed? Perhaps this will get rid of the black screen. Otherwise, is there any other way, other than by presenting modally to let the tab bar disappear?
Upvotes: 0
Views: 370
Reputation: 141
Try set the modalPresentationStyle of the presented controller i.e., Rewards ViewController by going to Attributes Inspector
Upvotes: 0
Reputation: 99
Alright, I think I have this figured out.
I added this to my Rewards view controller:
override func viewWillDisappear(_ animated: Bool) {
self.dismiss(animated: true, completion: nil)
super.viewWillAppear(true)
}
This resets the view controller as follows:
Upvotes: 0