3

I have a UICollectionView with cells that are filled with a background image. The collection view has line spacing = 0.

This has been working perfectly well on iOS 6.1, but when tested on the iPhone 6 with iOS 8.1.3 I see thin "see through" lines appearing spontaneously between cells on collection view load, and then they are jumping around when scrolling.

So, how do I get rid of these lines?

Lukas Kalinski
  • 2,213
  • 24
  • 26

4 Answers4

4

I found a solution: make sure that all cells have "Clip subviews" unchecked. I guess this must be a bug, as the solution doesn't make sense, but it solved the problem.

Lukas Kalinski
  • 2,213
  • 24
  • 26
1

EDIT* - This is actually caused by the app's deployment target being set as iOS7. When I switch to ios8, the problem goes away.

Sounds like you need to update your app to properly support iPhone 6/6+ screen sizes. One of my apps has this problem.

You'll need to go to your project settings and set a launch screen file so that it knows to show your app at actual size on the iphone 6/6+; otherwise, it will just show a scaled view of what one sees on the iPhone 5s.

I'm assuming this happens because the scaling from iphone5 to 6/6+ isn't exactly 1:1 pixel ratio. For example, because of imperfect scaling, a line at y:50 might be 1 pixel tall, but at y:51 it might be 2 pixels tall, which when scrolling causes a noticeable flicker.

Adama
  • 1,101
  • 8
  • 26
  • To test, make an empty tableview and scroll up and down and watch the gray lines slightly change sizes on your iphone6/6+ screen. – Adama Feb 13 '15 at 00:23
  • Oh, I totally forgot about the upscaling! Thank you! Now I have more work to do than I thought (I have to fill the space gaps with something), but it will look better. – Lukas Kalinski Feb 13 '15 at 10:55
  • @LukasKalinski, just realized this problem is actually caused by iOS7 doing the scaling. If your app has its deployment target set as iOS7, then the scaling(stretching) will look as previously described. If you set your deployment target to iOS8, it seems to fix this. So if you really want to avoid checking all your views for perfect autolayout compliance, you can still have this scaled view look good; just update your deployment target to iOS 8 in project settings. – Adama Feb 16 '15 at 18:38
  • Thanks for the update! Unfortunately I have to target iOS6+, so this would not have solved it for me. However, the solution you proposed initially worked well and the problem is gone since I implemented it. – Lukas Kalinski Feb 17 '15 at 06:48
  • Doesn't work for me, the edges of my cell still flickers. – Wraithseeker Mar 18 '16 at 19:16
1

I had the same problem, but it also happened on iPhone 4 with iOS7 (not only on iPhone 6 with iOS8.1). "See through" lines appeared between my section header and between the cells, some of them were permanent, others could just blink or disappear when I scrolled the view.

I could solve it expanding the background of my section header and cells by two pixels (in the bottom) and setting both views to not clip its subviews, as Lukas Kalinski suggested. Disabling clipping alone didn't work.

This worked for me, but it's kind of a hack. Not sure why iOS is presenting this behavior. I feel like we're still missing something.

I didn't try the suggested answer because I need to support iOS6+ and I can't stop using the iPhone 6 scale mode.

john1034
  • 128
  • 1
  • 8
  • In my case the collectionview items did not perfectly fit the width of the collection view. After I made sure the total width/height is a clean fraction of the width/height of a cell the problem disappeared. – scrrr Jan 06 '18 at 17:26
0

Check if the width and height of your collection view is an exact multiple of the widths and heights of your cells.

scrrr
  • 5,135
  • 7
  • 42
  • 52