0
Есть ли способ найти индекс раздела UICollectionView?Есть ли способ найти индекс раздела UICollectionView?
My CollectionView заполнен массивами, которые содержатся в основном массиве, и мне нужно выбрать соответствующий раздел.
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let collectionCell: ChecklistCollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier("collectionCell", forIndexPath: indexPath) as! ChecklistCollectionViewCell
let section = //I need the index of the current section here!
let sectionArray = allCards[section]
collectionCell.imageCell.image = UIImage(named: sectionArray[indexPath.row])
return collectionCell
}
Подобно тому, как это сделано здесь:
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
let sectionArray = allCards[section]
return sectionArray.count
}
ли вы понять это ?? –