按下时如何手动隐藏表格视图单元格?

时间:2015-06-27 22:45:07

标签: ios swift

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        //hide this cell.
    }

奖金 - 有没有办法“淡出”效果,所以它不是那么刺耳?

1 个答案:

答案 0 :(得分:1)

here is a great tutorial on this topic

长话短说,做这样的事情

    override func tableView(tableView: UITableView,
    commitEditingStyle editingStyle: UITableViewCellEditingStyle,
    forRowAtIndexPath indexPath: NSIndexPath) {
    switch editingStyle {
    case .Delete:
        // remove the deleted item from the model
        self.items.removeAtIndex(indexPath.row)

        // remove the deleted item from the `UITableView`
        self.tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
    default:
        return
    }
}