问题:Swift swift删除单元格 动态添加IndexPath
描述:

override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
        //判断是否是删除按钮
        if editingStyle == UITableViewCellEditingStyle.delete{
            //删除选中度假区所在行
            vacationList.remove(at: indexPath.row)
            //删除所在单元格
            tableView.deleteRows(at: [IndexPath], with: UITableViewRowAnimation.top)

        }
    }

解决方案1:

你的tableView.deleteRows(at: [IndexPath], with: UITableViewRowAnimation.top)这里 的IndexPath是类型 应该用indexPath。
我自己写cell的删除比较习惯截图的写法

上一篇terminal 里面 ping 百度,报错 Unknown host,求解决,谢谢
下一篇app 内嵌网页 h5调起微信支付时 页面出现空白
明星图片
相关文章
《Swift swift删除单元格 动态添加IndexPath》由码蚁之家搜集整理于网络,
联系邮箱:mxgf168#qq.com(#改为@)