-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
to_navigationBar is nil but navigationBar is not? #10
Comments
Maybe it would be helpful to mention that the navigation controller is not the root controller of the app's window, unlike in the Example app. I don't know if it has to do with anything, just fyi |
I found the issue however it will be a pain in the arsenal to solve in my project. I played a little in a test app and found out that if the navigation controller with the to_navigation is not a top navigation controller, it doesn't work as expected. I use a similar architecture in my app to this: Navigation Controller -> Container View -> Navigation Controller -> Plain View Controller -> View Controller with Table View and transparent to_navigationBar |
G'day Adam! Thanks so much for the thorough description of your use case! Hmm, I wonder if it is indeed a bug with the way I set up the logic for The logic for it is here: https://github.com/TimOliver/TONavigationBar/blob/master/TONavigationBar/TONavigationBar.m#L376 It basically starts at navigation controller you call it on, and works its way up the chain to find the last visible one. This logic might not be correct (In fact, I'm trying to remember why I even did it like that to begin with. 😅) In any case, the point of that method is to be only a convenience method so you don't have to manually typecast the Since you're writing it in Swift, it might be worth writing your own extension for now, and see if you can get it working that way. Without actually testing this code at all, I would imagine implementing the same method in Swift would look like: extension UINavigationController {
public var toNavigationBar: TONavigationBar? {
if let navbar = self.navigationBar as? TONavigationBar {
return navbar
}
return nil
}
} See if that works for you. If so, I might have to re-write how that method works. :) Thanks! |
I changed the TONavigationBar.m a bit to this
I needed a solution quickly because it was starting to drive me insane and this did the trick :D |
Hahaha glad to hear you got it working. I probably should fix this. So we can leave this issue to remind me to get around to doing this. Thanks for letting me know! |
I encountered a problem with this framework, I might be using it wrong somehow but I followed the instructions. I create my navigation controller like this:
self.rootViewController = UINavigationController(navigationBarClass: TONavigationBar.self, toolbarClass: nil)
I'm using the Coordinator patter here so rootViewController is declared as
var rootViewController: UINavigationController
In my detail view controller the navigation bar does not hide, the console output is quite strange, see for yourself
The text was updated successfully, but these errors were encountered: