gpt4 book ai didi

ios - 在 UITableView 中删除行时断言失败

转载 作者:行者123 更新时间:2023-11-29 00:50:18 25 4
gpt4 key购买 nike

当我删除表格 View 中的行时,出现以下异常:

*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UITableView.m:1716

这是我的代码的一部分:

[self.feedListView.tableView beginUpdates];
[self.feedListView.tableView deleteRowsAtIndexPaths:@[ atIndexPath ] withRowAnimation:UITableViewRowAnimationFade];
[self.feedListView.tableView endUpdates];

还有屏幕截图:

enter image description here

感谢任何帮助。

谢谢

最佳答案

您需要从 self.allFeeds 中移除 feedToDelete:

[self.feedListView.tableView beginUpdates];
NSMutableArray *array = [self.allFeeds mutableCopy];
[array removeObject:feedToDelete];
self.allFeeds = array;
[self.feedListView.tableView deleteRowsAtIndexPaths:@[ atIndexPath ] withRowAnimation:UITableViewRowAnimationFade];
[self.feedListView.tableView endUpdates];

关于ios - 在 UITableView 中删除行时断言失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38187029/

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