0
我正在使用PFQueryTableViewController顯示來自PFObjects的數據,但我想爲沒有對象顯示時創建替代單元格。我嘗試這樣做,但是當我在numberOfRowsInSection中返回1時,出現以下錯誤: *由於未捕獲異常'NSRangeException',原因:'* - [__ NSArrayM objectAtIndex:]:index 0超出了空數組邊界「PFQueryTableViewController「沒有結果」單元格
我不知道該怎麼做,但這裏是我的代碼:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if ([self.objects count] != 0){
// Return the number of rows in the section.
return [self.objects count];
}else{
return 1;
}
}
添加您cellForIndexPath功能。我預測這是你的問題。 – Dehli 2014-09-24 16:47:50
我已經有cellForRowAtIndexPath。還有其他建議嗎? – 2014-09-24 17:34:36
它是什麼樣子。我懷疑這是錯的。 – Dehli 2014-09-24 17:38:58