2016-12-16 8 views

答えて

2

、あなたが使用することができます。

func supplementaryView(forElementKind elementKind: String, 
       at indexPath: IndexPath) -> UICollectionReusableView? 

をインデックスパスで補足ビューを取得します。

アウトApple's documentation

1

あなたが使用することができますチェック:

func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath){ 
    let indexHeaderForSection = NSIndexPath(row: 0, section: indexPath.section) // Get the indexPath of your header for your selected cell 
    let header = collectionView.viewForSupplementaryElementOfKind(indexHeaderForSection) 
} 
+0

はい、私はdidSelectItemAtIndexPathにヘッダーを取得していますが、任意の項目を選択し、その後、コレクションビューをスクロールしたとき、それはヘッダーではなく、null値を与えます。セクションにはキューがありませんので、私は思っています。 –

+0

これは正常ですが、ヘッダーは表示されません。 –

+0

あなたは何か考えていますか、その解決策は何ですか? –

関連する問題