Code Monkey home page Code Monkey logo

Comments (7)

WorldDownTown avatar WorldDownTown commented on September 4, 2024

Hi, thank you for opening the issue. I realized the same problem. In iOS 10, it seems that UINavigationControllerDelegate does not call navigationController:interactionControllerFor: and navigationController:animationControllerFor:from:to:. But I solved this problem. Check this commit (b043764). Furthermore I made branches for new Swift version. You can build this immediately in Xcode 8 GM seed.
https://github.com/WorldDownTown/ZoomTransitioning/tree/swift-2.3
https://github.com/WorldDownTown/ZoomTransitioning/tree/swift-3

zoom_transitioning

from zoomtransitioning.

manuelCarlos avatar manuelCarlos commented on September 4, 2024

Wow, that's great! Thank you for the quick reply.
I'll check it out.
Have a great weekend!

from zoomtransitioning.

manuelCarlos avatar manuelCarlos commented on September 4, 2024

It's looking better, but once you start the edge pan gesture there's no way of canceling the transition. Apparently the UIPercentDrivenInteractiveTransition's cancel() method does not interrupt the pop transition once it's initiated. ( UIKit shenanigans i suspect )
To work around this, you might consider replacing the cancel() call with update(0.0), to revert the animation back. It will look like this:

 case .cancelled, .ended:
        guard let view = recognizer.view else { return }
        let progress = recognizer.translation(in: view).x / view.bounds.width
        let velocity = recognizer.velocity(in: view).x

        if progress > 0.33 || velocity > 1000.0 {
            finish()
        } else {
             update(0.0)
        }
        interactive = false
    default:
        break
    }

Thanks again. Was really helpful 👍

from zoomtransitioning.

manuelCarlos avatar manuelCarlos commented on September 4, 2024

Just noticed that the approach I suggested above works fine for the edge pan gesture transition, but will freeze the back button on navigation controller, sorry. 🙁

from zoomtransitioning.

manuelCarlos avatar manuelCarlos commented on September 4, 2024

I think this time i found a IOS10 workaround that works, :

// MARK: - UIGestureRecognizerDelegate
extension ZoomInteractiveTransition: UIGestureRecognizerDelegate {

public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
    interactive = true
    if #available(iOS 10.0, *) {
     // store the popped viewController, to be added back to the navigation stack
      vc = navigationController?.popViewController(animated: true)
    }
    return true
}

On ZoomInteractiveTransition class

weak var vc: UIViewController?
  . . .

    // on handlePanGestureRecognizer(_:)
  case .cancelled, .ended:
        . . .
        if progress > 0.33 || velocity > 1000.0 {
            finish()
        } else {
            // add back the popped view controller into the navigation stack
            navigationController?.viewControllers.append(vc!)
            update(0.0)
            cancel()

        }
        interactive = false
    default:
        break
    }

On ZoomTransitioning's animateTransitionForPop(_:), call transitionContext.completeTransition always with true

fileprivate func animateTransitionForPop(_ transitionContext: UIViewControllerContextTransitioning) {
   ...
    UIView.animate(
       ..
        },
        completion: { _ in
           ...

           transitionContext.completeTransition(true)
    })
}

This is the best i could come up with. It's pretty awful. Give it a try, hope it helps.

from zoomtransitioning.

WorldDownTown avatar WorldDownTown commented on September 4, 2024

Oh, great idea! I checked that code, then it worked fine for me. I have adopted your solution.

from zoomtransitioning.

WorldDownTown avatar WorldDownTown commented on September 4, 2024

So the problem was solved, I close this issue.

from zoomtransitioning.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.