[UITableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:]: row (0) beyond bounds (0) for section (0).?
原因:表視圖還沒有任何行或部分。兩種可能性。
1:檢查 numberOfRowsInSection 委托和 numberOfSectionsInTableView 以便它們不會設(shè)置為0.
2:可能 tableview 有尚未完成加載數(shù)據(jù)。
解決方法:
執(zhí)行 ?[UITableView reloadDate] ? 或者其他刷新 UITableView 的方法
self?.tableView.beginUpdates()
?self?.tableView.reloadData()
?self?.tableView.endUpdates()
2:把數(shù)據(jù)加載放回主線程,先保證數(shù)據(jù)加載完整了再執(zhí)行數(shù)據(jù)源的代理方法。
參考文章: