简体   繁体   English

逐格滚动表格视图

[英]Scroll table view cell by cell

I have a table and i want the rows to be displayes row by row , not all in the same time and after all visible rows are showed to scroll the table to see the rest . 我有一个表,我希望这些行逐行显示,而不是同时显示所有行,并且在显示所有可见行后滚动表以查看其余部分。

I did this : 我是这样做的:

- (void)viewDidAppear:(BOOL)animated{

    [self.tableView setContentOffset:CGPointMake(0.0, self.tableView.contentSize.height - self.tableView.bounds.size.height)
                   animated:YES];

    [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:29 inSection:0]
                     atScrollPosition:UITableViewScrollPositionBottom
                             animated:YES];

}

but my table is populated all in the same time , and the scroll is too fast to the last cell. 但是我的表格是在同一时间填充的,因此滚动到最后一个单元格的速度太快了。 Any ideea ? 有什么想法吗?

Do you need these? 需要这些吗?

UIScrollViewDelegate:

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;

I guess you want to increase one row each time when user tries to scroll to see next row. 我想您想在用户尝试滚动查看下一行时每次增加一行。

if you want to do this then you have to make a logic like this 如果你想这样做,那么你必须做出这样的逻辑

1.) first you have to limit the no of rows to popup in table view by using a variable(so that initially no of rows would be equal to table view height). 1.)首先,您必须使用变量来限制要在表格视图中弹出的行数(这样一来,最初的行数将不等于表格视图的高度)。

2.) then you have to use table view delegate method which calls when the table is tried to scrolled by user to increase the variable count by one. 2)然后您必须使用表视图委托方法,该方法在用户尝试滚动表以将变量计数增加一时调用。

3.) reload the table view. 3.)重新加载表格视图。

by that you can increase the row of table view accordingly 这样,您可以相应地增加表格视图的行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM