I have a problem managing my UICollectionsView with flowlayout and orientation. Mostly problems arise when I switch to landscape, some of the UICollectionViewCells are missing. They appear again when I start to scroll. It should be able to show the whole cell, since there is much more space on contentSize.
I even tried in my layout:
- (BOOL) shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds { return YES; }
With the same results.
Anyone have any ideas on this issue? I included an image about how my layout is organized and the expected behavior:

To add more detailed information, each of the color-coded cells belongs to its own section, and I change my second part to the right to change the orientation using:
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { NSArray* attributesToReturn = [super layoutAttributesForElementsInRect:rect]; for (UICollectionViewLayoutAttributes* attributes in attributesToReturn) { NSIndexPath* indexPath = attributes.indexPath; if (nil == attributes.representedElementKind) { attributes.frame = [self layoutAttributesForItemAtIndexPath:indexPath].frame; } else { NSString *kind = attributes.representedElementKind; attributes.frame = [self layoutAttributesForSupplementaryViewOfKind:kind atIndexPath:indexPath].frame; } } return attributesToReturn; }
It seems that the number of elements in layoutAttributesForElementsInRect is completely different from the landscape and in the portrait.
ios ipad uicollectionview uicollectionviewcell uicollectionviewlayout
Frank
source share