PopupDialog icon indicating copy to clipboard operation
PopupDialog copied to clipboard

Is it possible to switch to another view with a rotate animation?

Open ergunkocak opened this issue 7 years ago • 7 comments

First of all tnx for such nice library :)

Is it possible to switch between custom views with a rotate (flip popup) animation?

Cheers

ergunkocak avatar Mar 28 '17 11:03 ergunkocak

Kind a changeViewControllerWithAnimation

ergunkocak avatar Mar 28 '17 13:03 ergunkocak

Hello again :)

I wrote this which is what i needed and putting here also if you want to add to the library.

extension PopupDialog {
    public func animateTo(_ vc: UIViewController) {
        if #available(iOS 9.0, *) {
            let stackView = popupContainerView.stackView as! UIStackView
            let vcToRemove = childViewControllers[0]
            addChildViewController(vc)
            viewController = vc
            viewController.didMove(toParentViewController: self)
            vcToRemove.removeFromParentViewController()

            UIView.transition(with: popupContainerView.stackView, duration: 0.1, options: [.beginFromCurrentState], animations: { _ in
                stackView.removeArrangedSubview(vcToRemove.view)
                stackView.addArrangedSubview(vc.view)
            })
            UIView.transition(with: popupContainerView, duration: 0.35, options: [.transitionFlipFromRight], animations: nil)
        } else {
            let stackView = popupContainerView.stackView as! TZStackView
            let vcToRemove = childViewControllers[0]
            addChildViewController(vc)
            viewController = vc
            viewController.didMove(toParentViewController: self)
            vcToRemove.removeFromParentViewController()

            UIView.transition(with: popupContainerView.stackView, duration: 0.1, options: [.beginFromCurrentState], animations: { _ in
                stackView.removeArrangedSubview(vcToRemove.view)
                stackView.addArrangedSubview(vc.view)
            })
            UIView.transition(with: popupContainerView, duration: 0.35, options: [.transitionFlipFromRight], animations: nil)
        }
    }
}

ergunkocak avatar Mar 29 '17 14:03 ergunkocak

Thanks @ergunkocak, I will be looking into this very soonish 👍 🥇

mwfire avatar Mar 29 '17 22:03 mwfire

https://github.com/Orderella/PopupDialog/pull/177

metisdev avatar Dec 04 '17 21:12 metisdev

@mwfire i made a pull request, fyi

ergunkocak avatar Dec 13 '17 08:12 ergunkocak

Any updates on the merge?

ergunkocak avatar Jun 18 '19 13:06 ergunkocak

@mwfire will this be merged at all? :(

ergunkocak avatar Oct 13 '19 19:10 ergunkocak