2014-09-24 61 views
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; 
    } 
} 
+0

添加您cellForIndexPath功能。我預測這是你的問題。 – Dehli 2014-09-24 16:47:50

+0

我已經有cellForRowAtIndexPath。還有其他建議嗎? – 2014-09-24 17:34:36

+0

它是什麼樣子。我懷疑這是錯的。 – Dehli 2014-09-24 17:38:58

回答

相關問題