قالب وردپرس درنا توس
Home / IOS Development / ios – CollectionViewController Header starts from the screen side Swift 4

ios – CollectionViewController Header starts from the screen side Swift 4



I have a collectionviewcontroller and have added a header view to the one in code. The heading starts from below the status bar, so it looks strange because the header is colored while my collection view is white.

Is there any way to fix this, or at least get the color. I tried to use a view, but it appears over the header, and if I change the z position, it goes behind the entire collection view.

I have attempted to restrict such

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

When I run, the status bar just goes black and the headline stays in the same place
 Enter Image Description Here


Source link