UICollectionViewCell hidden though I never set it hidden

838 views Asked by At

I'm quite amazed by the result I get from those lines:

[cell setHidden:NO];
NSLog(@"CELL = %@", cell);
NSLog(@"HIDDEN = %hhd", cell.hidden);

Output:

2015-06-13 19:35:53.923 CELL = <DetailedSqeedCollectionViewCell: 0x145660b0; baseClass = UICollectionViewCell; frame = (-20 -49; 0 0); clipsToBounds = YES; hidden = YES; opaque = NO; layer = <CALayer: 0x1582cd90>>
2015-06-13 19:35:53.923 HIDDEN = 1

How is it possible, does anyone have a clue?

Thanks in advance.

1

There are 1 answers

0
cvu On

I had this problem. iOS is smart enough to hide cells if the underlying subviews, in my case the imageView's frame was outside the bounds and not showing. Make sure if any subviews you have are set properly.

You will also find that if you set the background cell color to something that does not match the UICollectionView, it will not be shown hidden anymore.