且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

TableView 在删除时不选择新行

更新时间:2023-02-06 23:39:32

至少,选择部分需要在更新块之外!把它放在你的 endUpdates 调用之后.

At the very least, the selection part needs to be outside the updates block! Put it after your endUpdates call.

如果这不起作用,请更进一步:尝试使用延迟性能(例如 dispatch_after)进行选择部分.现在您正在尝试执行选择,而我们仍在响应 commitEditingStyle 的过程中 - 我们甚至还没有删除该行.延迟性能让界面在删除后稳定下来.

If that doesn't work, go even further: Try doing the selection part using delayed performance (e.g. dispatch_after). Right now you're trying to perform the selection while we're still in the middle of responding to commitEditingStyle - we haven't even deleted the row yet. Delayed performance lets the interface settle down after the deletion.

您将需要使用与删除后情况相对应的索引编号.

You will need to use index numbering corresponding to the situation after the deletion.