无法传递 tableview 单元格值以删除单元格

Trouble passing tableview cell value to delete cell

我正在尝试传递一个值来更新 tableview 单元格。问题是我无法获得价值。表格视图单元格代码为:

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell;

    // Gets staff name and puts it in the cell title
    var sectionTitle:String = aventurasUnicas.objectAtIndex(indexPath.section) as String
    var sectionStaff:Array = porAventura[sectionTitle]!
    let staffNic:String = sectionStaff[indexPath.row] as String
    cell.textLabel?.text = staffNic

    // Gets the subtitle
    var subtituloAventura:String = "\(sectionTitle).\(staffNic)" as String
    var sectionStaff2:Array = subtituloTabla[subtituloAventura]!
    let staffNic2:String = sectionStaff2[0] as String
    cell.detailTextLabel?.text = staffNic2

    cell.accessoryType = UITableViewCellAccessoryType.DetailButton
    return cell
    }

我坚持使用的代码是:

override func tableView(tableView: UITableView?, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath?) {
    if (editingStyle == UITableViewCellEditingStyle.Delete) {
        // I AM STUCK HERE
    }
}

我想获取程序下一部分的staffNic。感谢您的帮助

为什么不走这条路——你得到它的方式就是你设置它的方式:

let sectionTitle:String = aventurasUnicas.objectAtIndex(indexPath.section) as String
let sectionStaff:Array = porAventura[sectionTitle]!
//the text of the deleted row based on your datasource
let staffNic = sectionStaff[indexPath.row] as String

或者将其作为单元格的文本获取:

let cell = tableView.cellForRowAtIndexPath(indexPath)!
let staffNic = cell.textLabel!.text!