0

So as titled, there're some situation that I found my cells not being displayed.

Here's a video to demonstrate the issue.

And there's the sample project.

I've a subclass of UICollectionViewFlowLayout. It happens that when I drag my cell across some point, my cell suddenly disappears.

In the log, I've make sure I returned the correct numbers of layout attributes in -layoutAttributesForElementsInRect:, however our UICollectionView returns an empty array for visibleCells

From my observation, is looks like if our layoutAttribute has one of the origin.x or origin.y becomes a negative value, UICollectionView seemed to consider it's out of bounds and not add to the view hierarchy.

I was wondering if anyone got any pointers for that. Appreciated any help.

James Tang
  • 945
  • 1
  • 9
  • 16
  • Do you happen to have a large header view above the first cell? Seeing a similar situation in my subclass as well when using auto-sizing cells. – dezinezync Jul 01 '15 at 19:47
  • No I don't really have added a header, but one thing might related is that my cells are full screen sized @dezinezync – James Tang Jul 02 '15 at 04:12
  • Mine are full-width, and of arbitrary height (determined by a UILabel). As a temporary fix, I enumerate over the layout attributes, find any attribute frames who's frame.origin.y is incorrect, and fix it. But this is a real temporary solution. – dezinezync Jul 02 '15 at 05:22
  • Technically the values are managed by UIKitDynamics and they are what they should be, it's just being considered not to add to the displayable items for some reasons. So I was wondering how we can "fix" correct values in this case? – James Tang Jul 02 '15 at 12:24
  • This may be a bug of UICollectionViewFlowLayout, See [this answer](http://stackoverflow.com/questions/12927027/uicollectionview-flowlayout-not-wrapping-cells-correctly-ios/13389461#13389461), maybe it would be helpful. – Billthas Jul 04 '15 at 06:04
  • Thanks Billthas, does see some relevant topics but didn't find an answer addressing the issue above since was like we are having the correct attributes but Collectionview decided not to display – James Tang Jul 04 '15 at 07:02

0 Answers0