Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ビューのindexPathForItemAtPointを使用して、セルのインデックスパスを取得しますが、UICollectionReusableView(ヘッダー/フッター)は取得しません。常にnilを返すためです。
独自のディクショナリ マッピング インデックス パスをヘッダー ビューに作成する必要があります。collectionView:viewForSupplementaryElementOfKind:atIndexPath:メソッドでは、ビューを返す前にディクショナリに入れます。collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:で、ディクショナリからビューを削除します。
collectionView:viewForSupplementaryElementOfKind:atIndexPath:
collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath: