telly / TLYShyNavBar

Unlike all those arrogant UINavigationBar, this one is shy and humble! Easily create auto-scrolling navigation bars!
MIT License
3.73k stars 427 forks source link

Allow specific view controller to be set if needed #121

Closed szweier closed 8 years ago

szweier commented 8 years ago

In the case where self is not the correct viewController to use for the navigation control you can now set a specific viewController using the new method.

Use case

A UINavigationController with a UITabBarController in it. We need to set the scrollView equal to the UIViewController's UITableView, but the ViewController needs to be the TabBarController.

Mazyod commented 8 years ago

Hey, thanks for your contribution! Sorry if I am missing the point, but why don't you just use:

viewController.shyNavBarManager;
szweier commented 8 years ago

I made the method that allows me to set a specific view controller during initialization to avoid having it default to using self. I tried using KVO to force write a new view controller after it set the default but it doesn't seem to override all set properties and doesn't function correctly. The only way I was able to set the property correctly was to do it once (rather than replacing the set view controller). This change will keep all current implementations the same as it will skip into the new method sending self. Otherwise if other implementations need to specify a different VC they can. Hopefully that explains it a little better.

szweier commented 8 years ago

Unless I'm not understanding your suggestion. I'll give another solution a shot first and see if it works but I feel as though this may be a beneficial addition regardless.

Mazyod commented 8 years ago

@szweier Sorry, I am always slow at understanding other people's point of view :sweat_smile: I just tried using your code, and I see why it is different. Thanks!

szweier commented 8 years ago

No problem, thanks.