![](/img/trans.png)
[英]'NSInvalidArgumentException' testViewController tableView:numberOfRowsInSection
[英][tableView numberOfRowsInSection:0 always returns 0
填充數據,但[tableView numberOfRowsInSection:0]
始終返回0.我的表中只有一個部分。 什么類型的東西可以導致這種行為?
如果表格中只有一個部分,請使用以下編輯...
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
或者,如果您的部分數量取決於數據源,您可以返回數據源的計數。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];
return [sectionInfo numberOfObjects];
嘗試這個。 它可能對你有幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.