Iphone tablerow删除但仍在表视图中显示

Iphone tablerow删除但仍在表视图中显示,iphone,ipad,iphone-sdk-3.0,ios4,ios-simulator,Iphone,Ipad,Iphone Sdk 3.0,Ios4,Ios Simulator,我的数据显示在表上,当我选择数据从数据库中删除数据而不是从表中删除数据时,我返回到其他视图,再次来到删除表视图,然后删除数据不再显示 我正在使用这个代码 - (void)deleteRowsAtIndexPaths:(NSArray *)indexPath withRowAnimation:(UITableViewRowAnimation)animation { NSLog(@"Hello"); } -(void) tableView:(UITableView *)tableVi

我的数据显示在表上,当我选择数据从数据库中删除数据而不是从表中删除数据时,我返回到其他视图,再次来到删除表视图,然后删除数据不再显示 我正在使用这个代码

- (void)deleteRowsAtIndexPaths:(NSArray *)indexPath withRowAnimation:(UITableViewRowAnimation)animation
{

    NSLog(@"Hello");

}


-(void) tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
forRowAtIndexPath:(NSIndexPath *)indexPath 

{
//  int row = [indexPath row];
    [self.table beginUpdates];
    if (editingStyle == UITableViewCellEditingStyleDelete) 
    {   
        Hadits *delHadit = [self.allBookMarks objectAtIndex:indexPath.row];
        dbAccess *dbmethods = [[dbAccess alloc] init]; 
        NSInteger delHaditid = delHadit.haditid;
        [dbmethods deleteBookMark:delHaditid];
        [dbmethods release];
    }       

    [self deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
                          withRowAnimation:UITableViewRowAnimationFade];
    [self.table endUpdates];

    NSLog(@"Hello");
    [self.table reloadData];

}
…需要帮助。。
关于Haseeb,视图中将出现准备有记录的数组,并在提交时添加一行

[self viewWillApear:YES];
并在视图中显示添加这一行

[yourTable reloadData];
从数据库中获取数据后,几乎没有错误(或者我认为没有显示相关代码)。您已经从数据库中删除了该条目,但我认为您没有从作为tableview数据源的数组中删除该条目

-(void) tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
forRowAtIndexPath:(NSIndexPath *)indexPath 
{
    [self.table beginUpdates];

    if (editingStyle == UITableViewCellEditingStyleDelete) 
    {   
    //  [self.table deleteRowsAtIndexPaths:[NSArray arrayWithObject: indexPath] withRowAnimation:UITableViewRowAnimationFade];
        Hadits *delHadit = [self.allBookMarks objectAtIndex:indexPath.row];
        dbAccess *dbmethods = [[dbAccess alloc] init]; 
        NSInteger delHaditid = delHadit.haditid;
        [dbmethods deleteBookMark:delHaditid];
        [dbmethods release];
        [self.allBookMarks removeObject:delHadit];/// change of code 
    }
    //[self.table reloadData];
    [table endUpdates];
}

我可以知道这个问题和这个有什么区别吗@KingofBlis我认为这个问题必须解决,因为它是一个完全重复的问题。给我你的查看代码将出现在你准备显示表的数组的地方。更新的提交代码-(void)view将出现:(BOOL)动画{dbAccess*dbMethods=[[dbAccess alloc]init];self.allBookMarks=[dbMethods getAllBookMarks];[dbMethods release];[self.table reloadData];}好的,如果你在提交中使用这一行[self-viewWillApear:YES];那么我认为它应该工作得很好。那么你在哪里崩溃了。你的应用程序在哪一行崩溃了。在table endUpadtestitles[1685:207]之后,最后使用这一行[self-ViewWillDisplay:YES]***断言失败-[UITableView_endCellAnimationsWithContext:,/SourceCache/UIKit_Sim/UIKit-1447.6.4/UITableView.m:976 2011-02-09 15:40:02.933标题[1685:207]***由于未捕获异常“NSInternalInconsistencyException”而终止应用程序,原因:“无效更新:节0中的行数无效。更新(5)后现有节中包含的行数必须等于更新(6)前该节中包含的行数。”,加上或减去从该节插入或删除的行数(插入0,删除0)。'