如何在 DidSelectItemAtIndexPath 上获取 Collection View 的标题,以便在选择项目时更改标题的文本。
最佳答案
您可以使用:
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)
}
关于swift - 如何快速获取 Collection View 的标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41180139/