Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it work with Navigation Controller? #3

Closed
AnnieNinaJoyceV opened this issue Mar 24, 2017 · 7 comments
Closed

Does it work with Navigation Controller? #3

AnnieNinaJoyceV opened this issue Mar 24, 2017 · 7 comments

Comments

@AnnieNinaJoyceV
Copy link

I tried adding Navigation Controller to Demo project and the detail view transition doesn't seem to be happening.

And thanks for this wonderful work :)

@av0c0der
Copy link
Contributor

@AnnieNinaJoyceV you're welcome!

This control wasn't designed to use within UINavigationController. Maybe there is a reason make it available to embed ElongationViewController to navigation stack, but I'm not sure about ElongationDetailViewController (the second one).

@AnnieNinaJoyceV
Copy link
Author

@jauzee I got it working by Tweaking func root(from context: UIViewControllerContextTransitioning) -> ElongationViewController
This works for me with UINavigationController - Navigation Bar hidden. I just wanted to know confirm whether there is some other approach. Thanks for your response.

fileprivate func root(from context: UIViewControllerContextTransitioning) -> ElongationViewController { guard let c = context.viewController(forKey: rootKey) else { return context.viewController(forKey: rootKey) as? ElongationViewController ?? ElongationViewController(nibName: nil, bundle: nil) } if (c.isKind(of: UINavigationController.self)) { guard let nv = c as? UINavigationController else { return context.viewController(forKey: rootKey) as? ElongationViewController ?? ElongationViewController(nibName: nil, bundle: nil) } let v = nv.topViewController return v as? ElongationViewController ?? ElongationViewController(nibName: nil, bundle: nil) } return context.viewController(forKey: rootKey) as? ElongationViewController ?? ElongationViewController(nibName: nil, bundle: nil) }

@av0c0der av0c0der assigned av0c0der and alexmik89 and unassigned av0c0der and alexmik89 Apr 11, 2017
@av0c0der
Copy link
Contributor

@AnnieNinaJoyceV, sorry for the delay. You did it in very complex way. We'll look on that.

@AnnieNinaJoyceV
Copy link
Author

@jauzee No problem, it works for me right now. I will wait for your solution to this.

@av0c0der
Copy link
Contributor

@AnnieNinaJoyceV fixed this issue in 1.0.4.

Actually we'll just check if there is an UINavigationContoller and if so we'll iterate over viewControllers looking for ElongationViewController.

@sasquatchgit
Copy link

sasquatchgit commented Feb 5, 2018

@AnnieNinaJoyceV code but formatted:

fileprivate func root(from context: UIViewControllerContextTransitioning) -> ElongationViewController {
        guard let c = context.viewController(forKey: rootKey) else {
            return context.viewController(forKey: rootKey) as? ElongationViewController ?? ElongationViewController(nibName: nil, bundle: nil)
            
        }
        if (c.isKind(of: UINavigationController.self)) {
            guard let nv = c as? UINavigationController else {
                return context.viewController(forKey: rootKey) as? ElongationViewController ?? ElongationViewController(nibName: nil, bundle: nil)
            }
            let v = nv.topViewController
            return v as? ElongationViewController ?? ElongationViewController(nibName: nil, bundle: nil)
        }
        return context.viewController(forKey: rootKey) as? ElongationViewController ?? ElongationViewController(nibName: nil, bundle: nil)
        
    }

@kunwar231
Copy link

how to show navigation bar on ElongationDetailViewController?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants