我有我的ViewController
它n
数量的部分在我的第一部始终显示我心愿产品(仅基于显示收藏在SettingsController
启用选项)每次UITableView
当我一个产品添加到我的愿望清单在我的DetailViewController
我触发NSNotificatiion
到我的ViewController
它将取回愿望清单记录。如何刷新特定部分?
我numberOfRowsInSection:
总是返回1
,因为它是一个UITableView + UICollectionView
组合产生水平+ Vertial滚动。
所以,我重装我的部分像下面这样,
if (isWishListSectionReloadRequires) {
NSArray *deleteIndexPaths = [NSArray arrayWithObjects:
[NSIndexPath indexPathForRow:0 inSection:0],
nil];
NSArray *insertIndexPaths = [NSArray arrayWithObjects:
[NSIndexPath indexPathForRow:0 inSection:0],
nil];
[tableView beginUpdates];
[tableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationNone];
[tableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationNone];
[tableView endUpdates];
} else {
[tableView reloadData];
}
但是,我面临崩溃之下,
断言失败 - [UITableView的_endCellAnimationsWithContext:]/SourceCache /UIKit_Sim/UIKit-2380.17/UITableView.m:1054 2016-11-04 04:25:15.921估计[9025:c07] ***因未捕获异常'NSInternalInconsistencyException'而终止应用,原因:'无效更新:无效数量部分。更新后表格视图中包含的节数(10)必须等于更新前表格视图中包含的节数(10),加上或减去插入或删除的节数(插入1次,1次删除)
谁能告诉我可能是什么原因?任何想法将不胜感激!
您是否相应地更新了数据源?我的意思是在一个部分的行数等? – KrishnaCA
@KrishnaChaitanyaAmjuri我如何手动更新数据源? – Praveenkumar
尝试 - (void)reloadSections:(NSIndexSet *)节withRowAnimation:(UITableViewRowAnimation)动画,而不是删除和插入。 – Sealos