Skip to content

Commit

Permalink
fix overfullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
lkzhao committed May 3, 2017
1 parent 5bcc7e0 commit 6819773
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
10 changes: 8 additions & 2 deletions Sources/Animator/HeroViewPropertyViewContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ internal class HeroViewPropertyViewContext: HeroAnimatorViewContext {
}

override func resume(timePassed: TimeInterval, reverse: Bool) {
viewPropertyAnimator?.stopAnimation(true)
viewPropertyAnimator?.finishAnimation(at: reverse ? .start : .end)
guard let visualEffectView = snapshot as? UIVisualEffectView else { return }
if reverse {
viewPropertyAnimator?.stopAnimation(false)
viewPropertyAnimator = UIViewPropertyAnimator(duration: duration, curve: .linear) {
visualEffectView.effect = reverse ? self.startEffect : self.endEffect
}
}
viewPropertyAnimator.startAnimation()
}

override func seek(timePassed: TimeInterval) {
Expand Down
12 changes: 6 additions & 6 deletions Sources/Hero.swift
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,6 @@ internal extension Hero {

context.clean()

// move fromView & toView back from our container back to the one supplied by UIKit
if (toOverFullScreen && finished) || (fromOverFullScreen && !finished) {
transitionContainer.addSubview(finished ? fromView : toView)
}
transitionContainer.addSubview(finished ? toView : fromView)

if finished && presenting && toOverFullScreen {
// finished presenting a overFullScreen VC
context.unhide(rootView: toView)
Expand All @@ -233,6 +227,12 @@ internal extension Hero {
container.removeFromSuperview()
}

// move fromView & toView back from our container back to the one supplied by UIKit
if (toOverFullScreen && finished) || (fromOverFullScreen && !finished) {
transitionContainer.addSubview(finished ? fromView : toView)
}
transitionContainer.addSubview(finished ? toView : fromView)

if presenting != finished, !inContainerController {
// only happens when present a .overFullScreen VC
// bug: http://openradar.appspot.com/radar?id=5320103646199808
Expand Down

0 comments on commit 6819773

Please sign in to comment.