Thursday, May 21, 2026
HomeiOS Developmentios - Grouped UICollectionView has additional 35 pixels of prime padding

ios – Grouped UICollectionView has additional 35 pixels of prime padding

[ad_1]

I am making a grouped UICollectionView, and it appears that evidently the highest has 35 pixels of additional padding on the prime I do not know the best way to eliminate.

It seems that is additionally an issue with UITableView and I’ve discovered some questions to handle it right here and right here, however these options do not work for UICollectionView.

Here is how I initialize my UICollectionView:

var listConfig = UICollectionLayoutListConfiguration(look: .grouped)
UICollectionView(body: .zero, collectionViewLayout: UICollectionViewCompositionalLayout.checklist(utilizing: listConfig))
// Extra autolayout constraints code later

Up to now to repair this I have been making use of a -35 fixed to the topAnchor, however that does not work in all circumstances (once I need one thing straight above in the identical view).

I additionally tried listConfig.headerTopPadding = 0 with no success.

How can I eliminate this additional prime padding? (And aspect query…why does that exist?)

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments