能不能 用一个 int 类型的 构造 NSIndexPath?

我看了一下 NSIndexPath 的构造方法 应该可以
于是我尝试
videoArray.removeAtIndex(index)
var indexPath = NSIndexPath(index: index) self.collectionView?.deleteItemsAtIndexPaths([indexPath])

但是 最后一行的时候 会报错

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the collection view after the update (1) must be equal to the number of sections contained in the collection view before the update (1), plus or minus the number of sections inserted or deleted

我觉得应该是构造的不对

阅读 5.7k
1 个回答

var index: NSIndexPath = NSIndexPath(forRow: 1, inSection: 1) 这样可以 我弄错了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题