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)!

    }

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

posted @ 2017-01-05 15:40  蓝天下的田埂上  阅读(1570)  评论(0编辑  收藏  举报