forked from shadowfacts/Tusker
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 {
|
||||
public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
|
||||
if presented is LargeImageViewController {
|
||||
return LargeImageExpandAnimationController()
|
||||
} else {
|
||||
return nil
|
||||
// if presented is LargeImageViewController {
|
||||
// return LargeImageExpandAnimationController()
|
||||
// } else {
|
||||
// return nil
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
|
||||
if let dismissed = dismissed as? LargeImageViewController {
|
||||
return LargeImageShrinkAnimationController(interactionController: dismissed.dismissInteractionController)
|
||||
} else {
|
||||
return nil
|
||||
// if let dismissed = dismissed as? LargeImageViewController {
|
||||
// return LargeImageShrinkAnimationController(interactionController: dismissed.dismissInteractionController)
|
||||
// } else {
|
||||
// return nil
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
|
||||
if let animator = animator as? LargeImageShrinkAnimationController,
|
||||
let interactionController = animator.interactionController,
|
||||
interactionController.inProgress {
|
||||
|
||||
return interactionController
|
||||
} else {
|
||||
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 vc = LargeImageViewController(image: image, description: description, sourceFrame: sourceFrame, sourceCornerRadius: sourceCornerRadius)
|
||||
vc.transitioningDelegate = self
|
||||
vc.modalPresentationStyle = .fullScreen
|
||||
return vc
|
||||
}
|
||||
|
||||
|
@ -125,6 +126,7 @@ extension TuskerNavigationDelegate where Self: UIViewController {
|
|||
let vc = LargeImageViewController(image: UIImage(data: gifData)!, description: description, sourceFrame: sourceFrame, sourceCornerRadius: sourceCornerRadius)
|
||||
vc.transitioningDelegate = self
|
||||
vc.gifData = gifData
|
||||
vc.modalPresentationStyle = .fullScreen
|
||||
return vc
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue