ios 4.3 UITableView/UITableViewCell w/自定义背景在删除时不重绘
我有一个 UITableView,它使用单元格的自定义背景图像(第一个和最后一个单元格的圆边)。当第一个或最后一个单元格被删除(通过 commitEditingStyleForRowAtIndexPath)时,tableView 不会立即重绘单元格。也就是说,如果我删除第一个单元格(具有圆角边缘),第二个单元格将成为第一个单元格(如预期),但它没有圆角边缘背景图像。直到该单元格被拖出视图,或者我切换到不同的选项卡并打开它。返回,“新”的第一个单元格具有适当的背景图像。现在,我可以在删除操作后调用 reloadData,这会强制整个表重新绘制,这似乎可行,但 API 文档建议不要这样做。看起来效率很低。所以,我的问题是,调用堆栈中的哪个位置是在 commitEditingStyleForRowAtIndexPath 操作后触发“新”第一个单元格重绘的最佳位置?
谢谢
I have a UITableView that uses custom background images for cells (rounded edges for the first & last cell). When the first or last cell is deleted (via commitEditingStyleForRowAtIndexPath), the tableView doesn't immediately redraw the cells. That is, if I delete the first cell (with the rounded edges), the second cell becomes the first cell (as expected), but it doesn't have the rounded edges background image. It is not until this cell is dragged out of the view, or I switch to a different tab & back, that the "new" first cell has the appropriate background image. Now, I can make a call to reloadData after the delete operation and this forces the whole table to redraw, which seems to work, but the API docs advise against doing this & it seems inefficient. So, my question is, where in the call stack is the best place to trigger a redraw of my "new" first cell after a commitEditingStyleForRowAtIndexPath operation?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅重新加载该行/单元格:
并为其指定 0 或(最后)的 indexPath 行,具体取决于它是哪一行。
Reload only that row/cell:
and give it an indexPath row of 0 or (last) depending on which one it was.