我正在使用UISplitViewController
創建一個小型的ipad應用程序,它有一個UIMasterViewController
和一個。我已經刪除了UITableView
附帶的UIMasterViewController
,我創建了我自己的UITableView
,從Xcode Objects面板中拖放一個。我曾想成功地用數據填充UITableView
,但是當我嘗試刪除單元格或記錄時,我似乎得到了「線程1:信號SIGABRT」錯誤。刪除UITableView單元格
下面是我的編輯按鈕代碼。 (這是一個自定義按鈕):
//Edit Button
int cnt = 0;
- (IBAction)buttonEditPressed:(id)sender {
if (cnt == 0){
[self.myTableView setEditing:YES animated:YES];
_buttonEdit.title = @"Done";
cnt++;
}
else if (cnt == 1){
[self.myTableView setEditing:NO animated:YES];
_buttonEdit.title = @"Edit";
cnt--;
}
}
而下面的代碼是在刪除應該發生(但給我的錯誤回報代替):
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if(editingStyle == UITableViewCellEditingStyleDelete){
[self.moduleTitleStack removeObjectAtIndex:indexPath.row];
[self.myTableView deleteRowsAtIndexPaths:[NSMutableArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
[self.myTableView reloadData];
}
[更新] numberOfRowsInSection實現:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//id <NSFetchedResultsSectionInfo> sectionInfo = [self.fetchedResultsController sections][section];
//return [sectionInfo numberOfObjects];
return [_numberOfRows count];
}
我會認爲這會做這項工作,但不知道爲什麼我得到這個錯誤。
你得到的錯誤是什麼? – Ismael
另外,你可以添加你的'numberOfRowsInSection:'實現嗎? – Ismael
@Ismael錯誤不是很清楚,它只是說線程1:信號SIGABRT(請參閱numberOfRowsInSection的更新:) – Led