Skip to content

Commit

Permalink
Alternative to not remove previous view
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmryan committed Aug 14, 2017
1 parent e4e0e85 commit 2e59d6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CustomTransitionDemo/PresentationController.swift
Expand Up @@ -9,5 +9,5 @@
import UIKit

class PresentationController: UIPresentationController {
override var shouldRemovePresentersView: Bool { return true }
override var shouldRemovePresentersView: Bool { return false }
}
5 changes: 2 additions & 3 deletions CustomTransitionDemo/PullDownAnimationController.swift
Expand Up @@ -25,8 +25,8 @@ class PullDownAnimationController: NSObject, UIViewControllerAnimatedTransitioni

func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
let inView = transitionContext.containerView
let toView = transitionContext.view(forKey: .to)!
let fromView = transitionContext.view(forKey: .from)!
let toView = transitionContext.viewController(forKey: .to)!.view!
let fromView = transitionContext.viewController(forKey: .from)!.view!

var frame = inView.bounds

Expand All @@ -43,7 +43,6 @@ class PullDownAnimationController: NSObject, UIViewControllerAnimatedTransitioni
})
case .dismissing:
toView.frame = frame
inView.insertSubview(toView, belowSubview: fromView)

UIView.animate(withDuration: transitionDuration(using: transitionContext), animations: {
frame.origin.y = -frame.size.height
Expand Down

0 comments on commit 2e59d6d

Please sign in to comment.