gpt4 book ai didi

iphone - moveRowAtIndexPath 不会刷新单元格的内容

转载 作者:行者123 更新时间:2023-12-03 18:34:50 25 4
gpt4 key购买 nike

iOS 5 最终为 UITableView 添加了 moveRowAtIndexPath:toIndexPath: 方法。问题是,调用它只会移动行,不会更新/重绘它。唯一的方法似乎是找到单元格并直接调用 setNeedsDisplay。但这很棘手,因为您永远不知道单元格是否已经移动。

我也无法调用 reloadRowsAtIndexPaths:,因为我不允许将 2 个动画应用于同一 beginUpdates-endUpdates block 内的单行。

我可以想到一些解决方法,比如将整个事情分成 2 个动画 block 。但我想知道我是否遗漏了一些东西,因为整个行为对我来说似乎很奇怪。

最佳答案

终于收到Apple关于此问题的官方答复:

Engineering has determined that this issue behaves as intended based on the following information:

Only insert and update cause the cell to be requested from the data source (the first because it's new and the second because you've explicitly told the table view to update the cell). Delete and move don't update the contents because that's not implicit in the action being performed. If you need to change the contents of the cell during the update, just reach into the cell and change the contents.

关于iphone - moveRowAtIndexPath 不会刷新单元格的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7861695/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com