Catalyst: Fix gallery presentation animation not working
This commit is contained in:
parent
d96ec2a732
commit
f3cf2dd8ec
|
@ -293,7 +293,7 @@ class GalleryItemViewController: UIViewController {
|
||||||
setNeedsUpdateOfHomeIndicatorAutoHidden()
|
setNeedsUpdateOfHomeIndicatorAutoHidden()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateZoomScale(resetZoom: Bool) {
|
func updateZoomScale(resetZoom: Bool) {
|
||||||
guard scrollAndZoomEnabled else {
|
guard scrollAndZoomEnabled else {
|
||||||
scrollView.maximumZoomScale = 1
|
scrollView.maximumZoomScale = 1
|
||||||
scrollView.minimumZoomScale = 1
|
scrollView.minimumZoomScale = 1
|
||||||
|
|
|
@ -38,7 +38,12 @@ class GalleryPresentationAnimationController: NSObject, UIViewControllerAnimated
|
||||||
}
|
}
|
||||||
|
|
||||||
let container = transitionContext.containerView
|
let container = transitionContext.containerView
|
||||||
itemViewController.view.layoutIfNeeded()
|
to.view.frame = container.bounds
|
||||||
|
container.addSubview(to.view)
|
||||||
|
|
||||||
|
container.layoutIfNeeded()
|
||||||
|
// Make sure the zoom scale is updated before getting the content view frame, since it needs to take into account the correct transform.
|
||||||
|
itemViewController.updateZoomScale(resetZoom: true)
|
||||||
|
|
||||||
let sourceFrameInContainer = container.convert(sourceView.bounds, from: sourceView)
|
let sourceFrameInContainer = container.convert(sourceView.bounds, from: sourceView)
|
||||||
let destFrameInContainer = container.convert(itemViewController.content.view.bounds, from: itemViewController.content.view)
|
let destFrameInContainer = container.convert(itemViewController.content.view.bounds, from: itemViewController.content.view)
|
||||||
|
@ -67,9 +72,8 @@ class GalleryPresentationAnimationController: NSObject, UIViewControllerAnimated
|
||||||
dimmingView.frame = container.bounds
|
dimmingView.frame = container.bounds
|
||||||
dimmingView.layer.opacity = 0
|
dimmingView.layer.opacity = 0
|
||||||
|
|
||||||
container.addSubview(dimmingView)
|
container.insertSubview(content.view, belowSubview: to.view)
|
||||||
container.addSubview(content.view)
|
container.insertSubview(dimmingView, belowSubview: content.view)
|
||||||
container.addSubview(to.view)
|
|
||||||
|
|
||||||
to.view.backgroundColor = nil
|
to.view.backgroundColor = nil
|
||||||
to.view.layer.opacity = 0
|
to.view.layer.opacity = 0
|
||||||
|
|
Loading…
Reference in New Issue