I have a UICollectionView that includes a supplementary view for each item in each section of the collection. When I try to use either of the init/final methods for supplementary views:
- (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingSupplementaryElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)elementIndexPath;
- (UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingSupplementaryElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)elementIndexPath;
The attributes that I'm returning do not appear to be affecting the supplementary views that are leaving (or entering) the collection view. The purpose of the supplementary views are as "spokes" for each of the items in the CV. The spoke should draw from the center of the view to its associated item. I am trying to modify the alpha, transform3d, etc of each leaving/arriving spoke's attributes to have it grow from or shrink into the center just like the item cells do. None of these attributes appears to affect the supplementary view that is entering/leaving the collection view.
I have modified the textbook CircleLayout to demonstrate the problem I am having. t's forked on Github here: https://github.com/dcoder2099/CircleLayout
The c997dea82a commit documents my changes. In it, I subclass UICollectionReusableView as my "SpokeReusableView" and in its init, attach a "SpokeLayer" instance which does the drawing via a subclass of CAShapeLayer. The origin and endpoint of the spoke are modeled as additional attributes in a subclass of UICollectionViewLayoutAttributes called SpokeAttributes.
The meat of the change (at least, what I expected to work) is the addition of the init/final methods for supplementary views, implemented in the CircleLayout.
But I cannot seem to get those attributes to affect the arriving/leaving spokes. I'm not sure if it's because of the way I'm implementing the drawing in CAShapeLayer or if I'm doing something wrong in the SpokeReusableView. Or if it's something mundane like mismanaging the layout attributes for all the items and supplementary views. Upon reading (and re-reading, and RE-READING) Apple's Collection View Programming Guide, I'm under the impression that the underlying animation system (CA?) is supposed to be applying the attributes as the supplementary views enter/leave, but I'm just not seeing it happen.
Any help would be greatly appreciated.