如何根据swift中CollectionView中的索引路径删除Section?

Kru*_*tel 1 uicollectionview swift

我的功能是当我删除关闭按钮部分,数据也从索引路径中删除.

我已经采取了UICollelctionReusableView for Section.

段数是根据Apple Data的数量排列的.

我有附加图像

头

并且数据附加到标题,如标题和一行.

我想点击关闭按钮时删除部分和行.任何人都可以帮我找到解决方案吗?

示例代码

  var index:NSIndexPath = sender.tag
    array.removeAtIndex(indexPath.row())
    self.coll.deleteItemsAtIndexPaths([sender.tag])
Run Code Online (Sandbox Code Playgroud)

Ire*_*ree 6

如果你想删除整个部分,它应该是这样的:

let section = sender.tag
array.removeAtIndex(section)
collectionView.deleteSections(NSIndexSet(index: section))
Run Code Online (Sandbox Code Playgroud)

鉴于所有部分数据都在里面array[section].