In UICollectionView
decoration and supplementary views seem to be a big mystery. There seems to be next to no example code at the moment. I managed to get both type
I had a similar symptom. My problem was that I had accidentally included the supplementary view's reuseID instead of the kindID when creating my custom layout.
Specifically I had this (Wrong)
UICollectionViewLayoutAttributes *attributes =
[UICollectionViewLayoutAttributes
layoutAttributesForSupplementaryViewOfKind:myViewReuseID
withIndexPath:sectionIndexPath];
When I should have this (Right)
UICollectionViewLayoutAttributes *attributes =
[UICollectionViewLayoutAttributes
layoutAttributesForSupplementaryViewOfKind:myViewKindID
withIndexPath:sectionIndexPath];
This meant that prepareForReuse was never getting called, and my old views never went away. Instead they kept piling up.