Reputation: 105
in my app there is a image on top of the collectionview header and i need the collectionview under the nav bar
Upvotes: 2
Views: 3858
Reputation: 8303
Set the collection view's contentInsetAdjustmentBehavior to .never
.
Upvotes: 0
Reputation: 59
Select the collection view, go to size inspector and set the content insets to never in the scroll view section
Upvotes: 3
Reputation: 335
You need to set the collectionView top constraint to view top constraint, not the topLayoutGuide bottom (as topLayoutGuide bottom is the bottom of navigation bar in your case).
Upvotes: 0
Reputation: 2568
You can set collectionView
constraints to the bottom of topLayoutGuide
in your UIViewController:
collectionView.translatesAutoresizingMaskIntoConstraints = false
collectionView.topAnchor.constraint(equalTo: topLayoutGuide.bottomAnchor, constant: 0).isActive = true
Upvotes: 0
Reputation: 19750
set automaticallyAdjustsScrollViewInsets
to true (it should be by default). You can do this in code or in the storyboard by selecting the view controller.
If that doesn't fix your issue you should adjust your autolayout constraints. if you can show how you have created the view layout I can guide you further.
Upvotes: 0