andreamazz / AMScrollingNavbar

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

Bug fixed. followScrollView function not working. #381

Closed YoungheeJang closed 4 years ago

YoungheeJang commented 4 years ago

Hello.

I used followScrollView function in my project. but followScrollView function have not been working. so followScrollView function fixed.

Because This logic can not passed guard block when reset a scrollableView.

I think, If self.scrollableView is not nil, play switch. And reset the new scrollableView always.

How about my propose?

andreamazz commented 4 years ago

Hi @YoungheeJang I'm not sure about this change, the followScrollView should not be called more than once without calling stopFollowingScrollView, because there's some setup that needs to be tore down between calls. Were you calling stopFollowingScrollView in your app?

YoungheeJang commented 4 years ago

Thanks you for your feedback @andreamazz

Were you calling stopFollowingScrollView in your app?

Now I am calling stopFollowingScrollView once when called viewWillDisappear. and I am calling followScrollView in viewWillAppear and dynamic followScrollView at the same ViewController.

I have been used AMScrollingNavbar in my projects.

MainViewController has many tab menu and tab's subViews, and subViews has scrollView. So I have to call dynamic followScrollView function when subView change(changed scrollView). And It has been worked well.

Since when, It is not working.

Now. I add my source stopFollowingScrollView before call followScrollView always, Then It is working now.

is it right?

andreamazz commented 4 years ago

Yes, you should call stop between "follow" calls, ideally you should call stop when the view disappears (i.e. when you switch a tab), and call follow again on appear.

YoungheeJang commented 4 years ago

Thank you @andreamazz !! Have a good day.