如何自动 slide/swipe 单元格 tableviewcell swift 3
how to automatically slide/swipe the cell tableviewcell swift 3
添加联系人等点击按钮时如何自动滑动单元格?有代表吗?
您应该实施 delegate
方法 - commitEditingStyle
您将完成!!
有点像,
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath)
{
// below code will delete one row - you can mange another kind of deletion here like delete from database also
if editingStyle == .Delete
{
yourDataArray.removeAtIndex(indexPath.row)
self.yourTableView.reloadData()
}
}
你可以点击按钮,
self.yourTableView.setEditing(true, animated: true)
在每个单元格上显示 (-) 符号!
添加联系人等点击按钮时如何自动滑动单元格?有代表吗?
您应该实施 delegate
方法 - commitEditingStyle
您将完成!!
有点像,
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath)
{
// below code will delete one row - you can mange another kind of deletion here like delete from database also
if editingStyle == .Delete
{
yourDataArray.removeAtIndex(indexPath.row)
self.yourTableView.reloadData()
}
}
你可以点击按钮,
self.yourTableView.setEditing(true, animated: true)
在每个单元格上显示 (-) 符号!