Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

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.

share|improve this question
    
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 1 '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 2 '15 at 4: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 2 '15 at 5: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 2 '15 at 12:24
    
This may be a bug of UICollectionViewFlowLayout, See this answer, maybe it would be helpful. – Billthas Jul 4 '15 at 6:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.