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? {
|
||||||
return nil
|
if presented is LargeImageViewController {
|
||||||
// if presented is LargeImageViewController {
|
return LargeImageExpandAnimationController()
|
||||||
// return LargeImageExpandAnimationController()
|
} else {
|
||||||
// } else {
|
return nil
|
||||||
// return nil
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
|
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
|
||||||
return nil
|
if let dismissed = dismissed as? LargeImageViewController {
|
||||||
// if let dismissed = dismissed as? LargeImageViewController {
|
return LargeImageShrinkAnimationController(interactionController: dismissed.dismissInteractionController)
|
||||||
// return LargeImageShrinkAnimationController(interactionController: dismissed.dismissInteractionController)
|
} else {
|
||||||
// } else {
|
return nil
|
||||||
// return nil
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
|
public func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
|
||||||
return nil
|
if let animator = animator as? LargeImageShrinkAnimationController,
|
||||||
// if let animator = animator as? LargeImageShrinkAnimationController,
|
let interactionController = animator.interactionController,
|
||||||
// let interactionController = animator.interactionController,
|
interactionController.inProgress {
|
||||||
// interactionController.inProgress {
|
|
||||||
//
|
return interactionController
|
||||||
// return interactionController
|
} else {
|
||||||
// } else {
|
return nil
|
||||||
// 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