Iphone 在UITableView位置插入一行

Iphone 在UITableView位置插入一行,iphone,objective-c,ios,xcode,cocoa-touch,Iphone,Objective C,Ios,Xcode,Cocoa Touch,我有一个表视图,我想在其中的某个位置插入一个新行。我已经这样做了,但它给出了意想不到的输出。我做错什么了吗 NSIndexPath *indexpath = [NSIndexPath indexPathForRow:position inSection:0]; NSArray *temp_array = [[NSArray alloc] initWithObjects:indexpath, nil]; [self.table insertRowsAtIndexPaths:temp_arr

我有一个表视图,我想在其中的某个位置插入一个新行。我已经这样做了,但它给出了意想不到的输出。我做错什么了吗

 NSIndexPath *indexpath =  [NSIndexPath indexPathForRow:position inSection:0];

NSArray *temp_array = [[NSArray alloc] initWithObjects:indexpath, nil];

[self.table insertRowsAtIndexPaths:temp_array withRowAnimation:UITableViewRowAnimationBottom];
我还需要做更多的事吗。我在一个单独的函数中执行此操作(在位置插入位置:) 非常感谢您的帮助……

试试这个

[self.table beginUpdates];
[self.table insertRowsAtIndexPaths:temp_array withRowAnimation:UITableViewRowAnimationBottom];
[self.table endUpdates];

您得到了什么意外结果?Pandey许多行变白,这里和那里出现了一些行。您可以从下面的链接获得帮助:您可以从下面的链接获得帮助:我怀疑的是,在执行此插入后,我是否需要在委托或任何其他方法中执行任何操作?