andreamazz / AMScrollingNavbar

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

A View between Navigation Controller and CollectionView not working with constraints #268

Closed omerfarukyilmaz closed 6 years ago

omerfarukyilmaz commented 7 years ago

Creating a Navigation Controller, Tab Bar, a UIView, and a Collection View programmatically I get this issue:

I may be doing something wrong myself. I am not very experienced creating views programmatically, so bare with me.

When the collectionview's constraints are set to topLayoutGuide.bottomAnchor, it works amazing. But when does there is any UIView in between, it does not work well.

Screenshot:

simulator screen shot - iphone 8 - 2017-09-18 at 22 09 22

Adding to the followers: [] also does not work.

Project Link replicating the issue: https://github.com/omerfarukyilmaz/ExampleAMScrollingNavbar

Sorry if the title is not very descriptive. I tried explaining detailed in the post.

Btw, love the library and I'm very grateful for it. 👍

toseefkhilji commented 6 years ago

+1

andreamazz commented 6 years ago

Hi @omerfarukyilmaz Sorry it took me so long to respond. The library is meant to follow and adapt the view for a scrollview, if you want to add a toolbar up top you should use the followers params, passing in your view. Alternatively you can use that view as the collectionview header.

omerfarukyilmaz commented 6 years ago

Collectionview header would actually do the trick! Thank you.

And no worries, the library is great so thank you for all your work 👍.

yogesh-nykaa commented 6 years ago

@omerfarukyilmaz Well changing navigationController.followScrollView(collectionView)

To

navigationController.followScrollView(collectionView, delay: 0.0, followers: [fakeView, collectionView])

will resolve the issue. I have tried the same and posting the answer.

@andreamazz Is there any way, we can scroll the green view to top, means hiding same as navigation bar along with navigation bar?