UICollectionView sets 3 cells per row to fit screen width

The iPhone's screen is 320 pt wide as we know it. I need to add 3 cells to a row and my UICollections width is also 320.

But the problem is here:

if we use, for example, 106pt for the cell width, then we have 2 pt of space between the cells. And this is correct, because viewing the collection automatically places the cells. If I use 107 pt for the cell width, then the collection view only shows 2 cells per row, which is also correct, but not for my purposes.

From coherences, I can check, for example, every 2 cells in the code and set 108 pt instead of 106 pt for that cell, but maybe there is another good solution with a constraint, for example?

+3
ios autolayout uicollectionview


source to share


No one has answered this question yet

Check out similar questions:

1473
Using Auto Layout in UITableView for Dynamic Cell Layouts and Variable Row Heights
103
How to set the spacing between cells and UICollectionView - UICollectionViewFlowLayout relation?
91
Specifying One Cell Dimension in UICollectionView Using Auto Layout
thirty
UICollection View Adjust cell size for screen size
28
UICollectionView, just set the cell to width?
nine
Align collection cells to match exactly 3 per line
4
Get number of rows in UICollectionView
0
How to display 3 cells in a row UICollectionView
0
how to set equal space for whole screen for uicollectionview
0
Set given number of cells in uicollectionview per row



All Articles
Loading...
X
Show
Funny
Dev
Pics