Dav*_*e G 2 uitableview ios swift
我一直在使用 editActionsForRowAt 创建内置的向左滑动功能来显示快速访问按钮,如下所示:
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
print("Is this working?")
//Code to create UITableViewRowAction buttons
return [button1, button2]
}
func tableView (_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
//I read I need this, so I have it
return true
}
func tableView (_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
//I read I need this, so I have it
}
Run Code Online (Sandbox Code Playgroud)
现在我的整个桌子,包括滑动,效果很好。直到...
我的 editActionsForRowAt 函数有代码,如果用户滑动扩展的单元格(默认情况下它们是 50,但用户可以点击以扩展高度),则 editActionsForRowAt 返回 [],一个空数组。我这样做是因为我不希望非常高的单元格显示伸出的按钮。
在那之后,即使在关闭之后,滑动单元格(任何单元格)也不会调用 editActionsForRowAt。我通过在该函数的开头添加一个打印行进行检查,并且无论我在滑动扩展单元格并返回 [] 后做什么,它都不会打印。
有想法该怎么解决这个吗?
| 归档时间: |
|
| 查看次数: |
1869 次 |
| 最近记录: |