Re-add custom LargeImageViewController presentation/dismissal animations
This commit is contained in:
parent
8a45837918
commit
730308df3f
|
@ -10,32 +10,29 @@ import UIKit
|
||||||
|
|
||||||
extension UIViewController: UIViewControllerTransitioningDelegate {
|
extension UIViewController: UIViewControllerTransitioningDelegate {
|
||||||
public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
|
public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
|
||||||
|
if presented is LargeImageViewController {
|
||||||
|
return LargeImageExpandAnimationController()
|
||||||
|
} else {
|
||||||
return nil
|
return nil
|
||||||
// if presented is LargeImageViewController {
|
}
|
||||||
// return LargeImageExpandAnimationController()
|
|
||||||
// } else {
|
|
||||||
// return nil
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
|
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
|
||||||
|
if let dismissed = dismissed as? LargeImageViewController {
|
||||||
|
return LargeImageShrinkAnimationController(interactionController: dismissed.dismissInteractionController)
|
||||||
|
} else {
|
||||||
return nil
|
return nil
|
||||||
// if let dismissed = dismissed as? LargeImageViewController {
|
}
|
||||||
// return LargeImageShrinkAnimationController(interactionController: dismissed.dismissInteractionController)
|
|
||||||
// } else {
|
|
||||||
// return nil
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
|
public func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
|
||||||
|
if let animator = animator as? LargeImageShrinkAnimationController,
|
||||||
|
let interactionController = animator.interactionController,
|
||||||
|
interactionController.inProgress {
|
||||||
|
|
||||||
|
return interactionController
|
||||||
|
} else {
|
||||||
return nil
|
return nil
|
||||||
// if let animator = animator as? LargeImageShrinkAnimationController,
|
}
|
||||||
// let interactionController = animator.interactionController,
|
|
||||||
// interactionController.inProgress {
|
|
||||||
//
|
|
||||||
// return interactionController
|
|
||||||
// } else {
|
|
||||||
// return nil
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,7 @@ extension TuskerNavigationDelegate where Self: UIViewController {
|
||||||
let sourceCornerRadius = sourceView.layer.cornerRadius
|
let sourceCornerRadius = sourceView.layer.cornerRadius
|
||||||
let vc = LargeImageViewController(image: image, description: description, sourceFrame: sourceFrame, sourceCornerRadius: sourceCornerRadius)
|
let vc = LargeImageViewController(image: image, description: description, sourceFrame: sourceFrame, sourceCornerRadius: sourceCornerRadius)
|
||||||
vc.transitioningDelegate = self
|
vc.transitioningDelegate = self
|
||||||
|
vc.modalPresentationStyle = .fullScreen
|
||||||
return vc
|
return vc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +126,7 @@ extension TuskerNavigationDelegate where Self: UIViewController {
|
||||||
let vc = LargeImageViewController(image: UIImage(data: gifData)!, description: description, sourceFrame: sourceFrame, sourceCornerRadius: sourceCornerRadius)
|
let vc = LargeImageViewController(image: UIImage(data: gifData)!, description: description, sourceFrame: sourceFrame, sourceCornerRadius: sourceCornerRadius)
|
||||||
vc.transitioningDelegate = self
|
vc.transitioningDelegate = self
|
||||||
vc.gifData = gifData
|
vc.gifData = gifData
|
||||||
|
vc.modalPresentationStyle = .fullScreen
|
||||||
return vc
|
return vc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue