Iphone 在表视图中显示选定行下的新数据

Iphone 在表视图中显示选定行下的新数据,iphone,ios,uitableview,Iphone,Ios,Uitableview,我在屏幕上有一个表视图,当视图打开时,它有五行 当我们选择行时,新行将添加到所选行的下方(新行=来自其他视图的数组计数) 当我们再次选择行时,它必须再次显示5行。就像在我的表视图中一样,当我们选择行时,将根据数组计数添加一些行。再次单击同一行,它必须再次显示5行。我该怎么做 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return currentr

我在屏幕上有一个表视图,当视图打开时,它有五行

当我们选择行时,新行将添加到所选行的下方(新行=来自其他视图的数组计数)

当我们再次选择行时,它必须再次显示5行。就像在我的表视图中一样,当我们选择行时,将根据数组计数添加一些行。再次单击同一行,它必须再次显示5行。我该怎么做

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{
     return currentrows;
}

if(selectedIndex == 0)
{   
     for (int j=1;j<=[passionarray count];j++) 
     {
          currentrows = currentrows + 1;
          NSLog(@"numberofrowsatindex %d",currentrows);
          NSIndexPath *indexPath1 = [NSIndexPath indexPathForRow:j inSection:0];

          [tableView insertRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath1, nil] withRowAnimation:UITableViewRowAnimationFade];
          selected=YES;
     }
-(NSInteger)表视图:(UITableView*)表视图行数节:(NSInteger)节
{
返回当前行;
}
如果(selectedIndex==0)
{   

对于(int j=1;j您是否重新加载表并强制它再次检查其数据源以刷新实际视图?它可能已经在代码中我们看不到的其他地方,但在增加数据源以反映新行数后,请调用
[tableView reloadData];

祝你好运