ここに私のコードは、選択された行を削除するはずです。行数が正しくないと主張しているため、アプリがクラッシュする原因になっています。私はチェックして、それは正しくありません。テーブルの行は削除されましたが、明らかに行数が更新されていません(コードがヒットします)...これはどのように可能ですか? (私は別のUITableViewController、正確なコードを、動作している)。どうすれば修正できますか?ここUITableView:削除後に「行数」が更新されないのはなぜですか?
if (editingStyle == UITableViewCellEditingStyleDelete) {
// remove row from the table
SQLite *sql = [[SQLite alloc] init];
[sql deleteReadingsRow: indexPath.row];
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
行の数を決定するコードである:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
SingletonListOfReadings *rShareInstance = [SingletonListOfReadings sharedInstance];
return rShareInstance.listOfReadings.count; // Return the number of rows in the section
}