Note that there are some explanatory texts on larger screens.

plurals
  1. POUICollectionView Decoration and Supplementary views can not be moved
    text
    copied!<p>In <code>UICollectionView</code> 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 types working in a custom layout (see this <a href="https://stackoverflow.com/questions/12810628/uicollectionview-decoration-view/12824761#12824761">post</a> for some details). As long as they remain in the same position everything is fine (i.e. if their <code>layoutAttributes.frame</code> does not change).</p> <p>However as soon as I re-layout with changed <code>layoutAttributes</code> for either decoration or supplementary views they get visually duplicated - i.e. there is a copy in the background at their original location and a copy at their new location. The behaviour is identical if I instantiate them from XIBs or completely in code and the behaviour does not occur for normal cells.</p> <p>At first I thought that it is some kind of redraw problem, but these "copies" survive re-layouting, redrawing etc. They are not real copies however, since the <code>layoutAttributesForDecorationView</code> etc. are never called for them (only for the new locations). There seems to be some caching in the background in the <code>UICollectionView</code>.</p> <p>Has anybody got this working or have any ideas. I must say that I am new to the iOS platform, so it could also be simple things like setting the "Clips Bound" or "Clear Graphics Context" properties (I tried those, but it could be something similar).</p> <p>This is driving me crazy and it is strange that there is absolutely no example code out there.</p> <p>I am asking myself: Are the decoration and supplementary views not meant to be repositioned? (I hope not)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload