https://github.com/andrewbennet/modaldismississueexample
A demo of an issue in iOS 11 when dismissing modally presented navigation controllers
https://github.com/andrewbennet/modaldismississueexample
bug ios11 swift swift-4 uikit xcode9
Last synced: 12 months ago
JSON representation
A demo of an issue in iOS 11 when dismissing modally presented navigation controllers
- Host: GitHub
- URL: https://github.com/andrewbennet/modaldismississueexample
- Owner: AndrewBennet
- Created: 2017-09-16T18:47:50.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-16T21:44:05.000Z (over 8 years ago)
- Last Synced: 2025-01-20T10:23:19.254Z (about 1 year ago)
- Topics: bug, ios11, swift, swift-4, uikit, xcode9
- Language: Swift
- Homepage: https://stackoverflow.com/q/46228862/5513562
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Modal Dismiss Issue Example
A demo of an issue in iOS 11 when dismissing modally presented navigation controllers
This project supplements [this stack overflow question](https://stackoverflow.com/q/46228862/5513562).
There are two ways of dismissing a modally presented navigation controller, from the final view controller in the navigation flow:
- Ask the presenting VC to dismiss it: `self.presentingViewController!.dismiss(animated: true)`
- Call dismiss on the navigation controller: `self.navigationController!.dismiss(animated: true)`
The second is allowed since the [docs](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621505-dismiss) say:
> If you call this method on the presented view controller itself, UIKit asks the presenting view controller to handle the dismissal.
They both have problems!
Type 1 produces a visual artifact: a duplicate VS is seen under the dismissed one
Type 2 needs to be called twice in order to work! Presumably, the first call is dismissing the search controller?...
-------
Resolved: Adding `searchController.isActive = false` to `viewWillDisappear` resolves the issue