最近做项目遇到一个功能,TableView 的编辑模式下 只需要移动的功能
代码如下
func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}
func tableView(tableView: UITableView, shouldIndentWhileEditingRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return false
}
func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}
func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
return .None
}
func tableView(tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath) {
}
本文介绍了如何在iOS应用中设置UITableView的编辑模式,仅允许用户进行行的移动操作,而不提供删除功能。通过特定的代码配置,可以实现这个定制化的表格视图编辑体验。
1894

被折叠的 条评论
为什么被折叠?



