In my app are three view controllers; White, red, and blue. White's is the main view of the app.
On button taps, White modally presents Red. Red modally presents blue. All is well. Blue has e.g. some form for the user to complete, then the user taps Dismiss on Blue.
Blue would like to return the user to the main UI, white. When the user taps Dismiss, this runs:
@IBAction func didTapDismissBoth(sender: AnyObject) {
let red = presentingViewController!
let white = red.presentingViewController!
white.dismissViewControllerAnimated(true, completion: nil)
}
Both Red & Blue do indeed dismiss, but Blue vanishes immediately and Red is seen doing the dismissal animation! The flash of red is visually jarring and easily visible in the Simulator when Slow Animations are on.
I would rather see Blue sliding gracefully off screen to reveal White.
Can I prevent Red from rearing its ugly head when returning to White from Blue?