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

Need to use a NavigationBar subclass with NavigationController #1074

Closed
phlippieb opened this issue May 18, 2018 · 4 comments
Closed

Need to use a NavigationBar subclass with NavigationController #1074

phlippieb opened this issue May 18, 2018 · 4 comments

Comments

@phlippieb
Copy link
Contributor

Hi!

As part of our app, we have UI elements similar to this. They are added as subviews of the navigation bar, but they display outside its bounds. These views must be tappable.

My solution was to subclass NavigationBar and override hitTest(:with). However, in order to use my subclass of NavigationBar, I had to fork Material and add a new designated initializer to NavigationController that accepts a navigationBarClass parameter, which it then passes to super:

public init(rootViewController: UIViewController, navigationBarClass: Swift.AnyClass?) {
    super.init(navigationBarClass: navigationBarClass, toolbarClass: nil)
    setViewControllers([rootViewController], animated: false)
}

This was necessary because the existing initializers on Material's NavigationController hide the initializer on UINavigationController that accepts a navigationBarClass parameter.

This is fine for us, for now, but we would prefer to point to this repo, and not our fork. Would you be interested in merging a PR that extends NavigationController with the ability to specify a navigationBarClass? Or is there perhaps another suggested way to achieve what I need?

@daniel-jonathan
Copy link
Member

Yes I would be. Please send it over and in general, I am interested in all PRs. Thank you!

@daniel-jonathan
Copy link
Member

Please link your PR to this issue and I will get it in for you.

@phlippieb
Copy link
Contributor Author

Great! I created pull request #1079 for this.

@daniel-jonathan
Copy link
Member

@phlippieb Awesome, I will merge this in tonight or tomorrow. Thank you! Closing this for now.

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

No branches or pull requests

2 participants