I am building an app using a tab bar view controller. What happens is as follows.
- I presented a view controller modally over a current context. I used
present(_:animated:completion:)with the property
- I selected a different tab bar item.
- I came back to the original tab bar item. So I saw the view controller presented in Step 1.
- I dismissed the view controller and got a black screen.
It seems that the instance method
present(_:animated:completion:) is dedicated to the case wherein the user comes back directly to the presenting view controller. So I guess I am supposed to disable any options that send a user to a different scene.
Another resolution would be using a navigation controller. I wondered whether I need to put additional navigation controllers to build a stack of view controllers, but it was not the case. I just need to use the method
pushViewController(_:animated:) of an instance of UINavigationController. So I only need one navigation controller. Once I used
pushViewController(_:animated:), I can dismiss the view controller by popping or
popViewController(animated:). In fact, there are two other options:
The following page is very helpful here: Pushing, Popping, Presenting, & Dismissing ViewControllers
I also checked Wikepedia. It says:
Users must interact with the modal window before they can return the parent application.