當我試圖從表格視圖中刪除一行時,我遇到了tableView
崩潰問題。該方法被正確調用,因爲正確地在數據庫中進行了更改。這是我收到的錯誤是:從表格視圖中刪除一行
無效更新:在第0
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSManagedObjectContext *context = [delegate managedObjectContext];
NSManagedObject *objectToDelete = [fixedArray objectAtIndex:indexPath.row];
[context deleteObject:objectToDelete];
[delegate saveContext];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
fixedArray = ([self mondayData]); // this is fetching the data for the array that I supply to the table view
[self.tableView numberOfRowsInSection:[fixedArray count]];
[self.tableView reloadData];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [fixedArray count];
}
你可以顯示你的代碼爲'tableView:numberOfRowsInSection:'? – jonkroll 2012-03-27 18:20:32
我已更新原始帖子以顯示section方法中的行數,並顯示嘗試在編輯後返回正確數量的行,但不幸的是得到相同的結果。 – dmeads89 2012-03-27 21:13:29