I just ran into a very strange problem regarding behavior UICollectionView, and I think both the presentation of the collection and I are rather confused.
I implemented a specific type of collection with a horizontal scroll direction in our project, and shortly after the quality control issued a ticket with an error saying that the distance between viewing elements of the collection is incorrect on some device. Once again I looked at the error and realized that the problem not only persists on this particular device, but also on all devices running iOS 9. On iOS 10, everything worked as expected.
So, I created a simple sample project to isolate the main problem that can be found on GitHub:
Firstly, I was even more confused by the fact that the sample project did not show an iOS 9 error. However, as soon as I set the value estimatedItemSizeto a non-zero value in order to use the cells for self-calibration (i.e., the automatic layout), the same thing happened again wrong distance.
I realized that only in these special circumstances - iOS 9 +estimatedItemSize != .zero - does the presentation of the collection actually confuse minimumLineSpacing with minimumInteritemSpacing, at least when implementing the corresponding delegate functions of the layout:
collectionView(_:layout:minimumLineSpacingForSectionAt:)
collectionView(_:layout:minimumInteritemSpacingForSectionAt:)
Therefore, whenever you want to specify one of these intervals, you must implement the other.
, , , . , , , ( Apple , ).
?

" " estimatedItemSize .zero () CGSize(width: 100, height: 50) ().