andreamazz / AMScrollingNavbar

Scrollable UINavigationBar that follows the scrolling of a UIScrollView
MIT License
6.05k stars 633 forks source link

Change direction of a follower? #312

Closed lpbas closed 6 years ago

lpbas commented 6 years ago

Hello! First of all I would like to thank you for this library, I've used it in almost all my projects!

I'm trying to create a custom TabBar instead of the normal TabBar, and I need to make it follow my scrollView. However, now with the library, my custom tabBar (it's actually a UICollectionView at the bottom of the creen that scrolls horizontally) moves upwads instead of downwards.

Is there a way to pass into the navigationController.followScrollView method the direction in which the custom view must follow the scrollView?

andreamazz commented 6 years ago

Hey @L4grange check out the latest commit in master, I've made some changes to the followers param. Now it's no longer an array of UIViews, but a custom object, NavigationBarFollower. This wrapper holds the view and the scroll direction. If you check the collection view sample, you'll see how to implement it.

navigationController.followScrollView(collectionView, delay: 50.0, followers: [NavigationBarFollower(view: customFooter, direction: .scrollDown)])
lpbas commented 6 years ago

Just what I needed! Thank you so much :)

lpbas commented 6 years ago

Just tested on my app and there seems to be a problem. My custom view has the exact same frame as a TabBar (but it's a UICollectionView) and when it slides down, its does not completely hide itself. There is about 5 pixels left visible of the top of the view. I can provide you with a screenshot if needed. Any ideas on how to fix this?

andreamazz commented 6 years ago

@L4grange should be fixed in master, let me know if that works

lpbas commented 6 years ago

Works perfectly now, thank you so much!