forked from shadowfacts/Tusker
Fix gallery controls popping in over content after presentation
This commit is contained in:
parent
6857529d06
commit
4fcc32ca4b
|
@ -59,9 +59,17 @@ class GalleryPresentationAnimationController: NSObject, UIViewControllerAnimated
|
||||||
let content = itemViewController.takeContent()
|
let content = itemViewController.takeContent()
|
||||||
content.view.translatesAutoresizingMaskIntoConstraints = true
|
content.view.translatesAutoresizingMaskIntoConstraints = true
|
||||||
|
|
||||||
container.addSubview(to.view)
|
// Use a separate dimming view from to.view, so that the gallery controls can be in front of the moving content.
|
||||||
container.addSubview(content.view)
|
let dimmingView = UIView()
|
||||||
|
dimmingView.backgroundColor = .black
|
||||||
|
dimmingView.frame = container.bounds
|
||||||
|
dimmingView.layer.opacity = 0
|
||||||
|
|
||||||
|
container.addSubview(dimmingView)
|
||||||
|
container.addSubview(content.view)
|
||||||
|
container.addSubview(to.view)
|
||||||
|
|
||||||
|
to.view.backgroundColor = nil
|
||||||
to.view.layer.opacity = 0
|
to.view.layer.opacity = 0
|
||||||
content.view.frame = sourceFrameInContainer
|
content.view.frame = sourceFrameInContainer
|
||||||
content.view.layer.opacity = 0
|
content.view.layer.opacity = 0
|
||||||
|
@ -77,6 +85,8 @@ class GalleryPresentationAnimationController: NSObject, UIViewControllerAnimated
|
||||||
let animator = UIViewPropertyAnimator(duration: duration, timingParameters: spring)
|
let animator = UIViewPropertyAnimator(duration: duration, timingParameters: spring)
|
||||||
|
|
||||||
animator.addAnimations {
|
animator.addAnimations {
|
||||||
|
dimmingView.layer.opacity = 1
|
||||||
|
|
||||||
to.view.layer.opacity = 1
|
to.view.layer.opacity = 1
|
||||||
|
|
||||||
content.view.frame = destFrameInContainer
|
content.view.frame = destFrameInContainer
|
||||||
|
@ -90,6 +100,8 @@ class GalleryPresentationAnimationController: NSObject, UIViewControllerAnimated
|
||||||
}
|
}
|
||||||
|
|
||||||
animator.addCompletion { _ in
|
animator.addCompletion { _ in
|
||||||
|
to.view.backgroundColor = .black
|
||||||
|
|
||||||
if sourceToDestTransform != nil {
|
if sourceToDestTransform != nil {
|
||||||
self.sourceView.transform = origSourceTransform
|
self.sourceView.transform = origSourceTransform
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue