0
我想用deleteRowsAtIndexPaths刪除從我的tableView一排,我用它來獲取特定行的NSIndexPath的代碼如下:無法轉換類型'nsindexpath?'的值預期參數類型「[nsindexpath]」
let pointInTable: CGPoint = sender.convertPoint(sender.bounds.origin, toView: self.tableView)
let cellIndexPath = self.tableView.indexPathForRowAtPoint(pointInTable)
但我一當我放下cellIndexPath爲deleteRowsAtIndexPaths標題中建議的錯誤。我知道它可能是關於NSIndexPath的數組類型,但我不確定我應該如何構造我的代碼。請幫忙謝謝!
該公司預計'[NSIndexPath]'所以你必須把它作爲一個數組: '[indexPath]':'if let indexPath = cellIndexPath {tableView.deleteRowsAtIndexPaths([indexPath],withRowAnimation:.None)' – Eendje
試試這個:'if let cellIndexPath = self.tableView.indexPathForRowAtPoint(pointInTable){self.tableView。 deleteRowsAtIndexPaths([cellIndexPath],withRowAnimation:.None)}' – Lucho