Tuesday, 27 November 2018

CollectionViewController Header start from screen edge Swift 4

I have a collectionviewcontroller and have added a header view to it in code. The header is starting from under the status bar so it looks weird because my header is colored while my collection view is white.

Is there any way to fix this, or at least get the color. I tried using a view but it then appears over the header, and if i change the z position it then goes behind the whole collectionview.

I have tried constrainting like so

self.collectionView.anchor(top: view.safeAreaLayoutGuide.topAnchor, leading: self.view.leadingAnchor, bottom: view.bottomAnchor, trailing: view.trailingAnchor)

When I run, the status bar area just goes black and the header stays at the same spot enter image description here



from CollectionViewController Header start from screen edge Swift 4

No comments:

Post a Comment