Very thin line between Collection View Cells
Asked Answered
T

1

6

I am seeing a very thin white line in between my collection view cells, even though I have set section insets to 0 and defined the collection view cell to be self.view.bounds.size.width/2 (there should be two cells per row next to each other).

enter image description here

(You may have to open the image in full-view to see the white line highlighted in blue).

This is visible on a physical iPhone X device.

Tripod answered 6/11, 2017 at 22:13 Comment(9)
What is minimumInteritemSpacing?Swamper
@Swamper the minimumInteritemSpacing is 0Tripod
Does this line visible only in iPhone X?Swamper
@Swamper I also tested on an iPhone 8 and it's visible.Tripod
If minimumInteritemSpacing == 0, I assume that the line is from cell. Can you show your code how to configure cell layout and collection layout?Swamper
try it Objective-C: minimumInteritemSpacing = CGFLOAT_MIN; swift: minimumInteritemSpacing =CGFloat.leastNormalMagnitudeShermy
I am experiencing a similar behaviour on iPhone 5s when presenting 3 cells per row. A very thin line appears between the second and third cell. When presenting 2, 4, 5, 6 cell per row everything is fine. It could be some rounding issue, but I still haven't found a way to fix it.Flyman
What kind of layout does this collection view use?Aftertaste
@Tripod were you ever able to figure this out?Carter
A
0

I was able to fix that by setting minimumInteritemSpacing to -2 and adding +1 to the cell width. Don't know if it's cover all edge cases but it's working for my issue. Hope that this will help someone else

Assam answered 13/11, 2019 at 9:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.