我的功能是当我删除关闭按钮部分时,数据也会从索引路径中删除。
我已经为 Section 选择了 UICollelctionReusableView。
section count 是根据 Apple Data 数量的数组。
我附上图片
数据附加到标题 像标题和一行。
我想在点击关闭按钮时删除部分和行。 谁能帮我找到解决方案?
示例代码
var index:NSIndexPath = sender.tag
array.removeAtIndex(indexPath.row())
self.coll.deleteItemsAtIndexPaths([sender.tag])
最佳答案
如果你想删除整个部分,它应该是这样的:
let section = sender.tag
array.removeAtIndex(section)
collectionView.deleteSections(NSIndexSet(index: section))
鉴于所有节数据都在 array[section]
中。
关于swift - 如何根据 CollectionView 中的索引路径快速删除部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38783683/