swift中editingStyleForRowAtIndexPath的写法

时间:2023-03-09 07:56:44
swift中editingStyleForRowAtIndexPath的写法

效果图:

swift中editingStyleForRowAtIndexPath的写法

首先要实现这句tableView.setEditing(true, animated: true)才能弹出左侧的小圆圈

然而在oc中tableview删除的写法百度一下很常见但是swift中包的很严实:

override func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {

return UITableViewCellEditingStyle(rawValue: UITableViewCellEditingStyle.Delete.rawValue | UITableViewCellEditingStyle.Insert.rawValue)!

}

这样选择的时候才会变成对号。