2012-03-01 74 views
0

我想使一个“的UITableView”,其动态scolls它的细胞的向下方向或向上方向上与下一个单元添加到从数组中的tableview。滚动的UITableView动态

请建议我在这个很好的例子。

感谢NEHA

回答

1

在这里你去:

- (IBAction)clickAction:(id)sender 
{ 
    [tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES]; 
    [tableView reloadData]; 
} 

或:

// (change n to whatever you like) 
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:n inSection:0]; 
    [self.tableView scrollToRowAtIndexPath:indexPath 
        atScrollPosition:UITableViewScrollPositionTop 
          animated:YES]; 

,如果你需要更复杂的东西让我们知道。

+0

hi shishi thnx for ur reply ....我希望应该添加表格记录并且表格单元格应该转移到下行方向,并且下一个记录应该自动添加 – 2012-03-02 12:35:55

1

在这个片段中,你可以滚动即使行尚未加载选择行的表。

- (void)viewDidAppear:(BOOL)animated 
{ 
    NSIndexPath *index = [NSIndexPath indexPathForRow:idx inSection:0]; 
    [_table selectRowAtIndexPath:index animated:YES 
           scrollPosition:UITableViewScrollPositionMiddle]; 
}