PopupDialog
PopupDialog copied to clipboard
Is it possible to switch to another view with a rotate animation?
First of all tnx for such nice library :)
Is it possible to switch between custom views with a rotate (flip popup) animation?
Cheers
Kind a changeViewControllerWithAnimation
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)
}
}
}
Thanks @ergunkocak, I will be looking into this very soonish 👍 🥇
https://github.com/Orderella/PopupDialog/pull/177
@mwfire i made a pull request, fyi
Any updates on the merge?
@mwfire will this be merged at all? :(