-(void)viewDidLoad
{
[NSTimer scheduledTimerWithTimeInterval: 0.035 target:self selector:@selector(scrollTableView) userInfo:nil repeats:YES];
[NSTimer scheduledTimerWithTimeInterval: 0.065 target:self selector:@selector(scrollTableView1) userInfo:nil repeats:YES];
}
-(void) scrollTableView
{
float w = 1;
CGPoint scrollPoint = leftTable.contentOffset;
scrollPoint.y = scrollPoint.y + w;
if (scrollPoint.y >= leftTable.contentSize.height - (leftTable.frame.size.height - 100) || scrollPoint.x <= -leftTable.frame.size.height + 924) {
w *= -1;
}
[leftTable setContentOffset:scrollPoint animated: NO];
}
-(void) scrollTableView1
{
float w = 1;
CGPoint scrollPoint = rightTable.contentOffset;
scrollPoint.y = scrollPoint.y + w;
if (scrollPoint.y >= rightTable.contentSize.height - (rightTable.frame.size.height - 100) || scrollPoint.x <= -rightTable.frame.size.height + 924) {
w *= -1;
}
[rightTable setContentOffset:scrollPoint animated: NO];
}
我正在使用此代码,它运行良好,两个表视图都可以根据需要在不同的持续时间上滚动,但是当我拖动一个表视图中的任何一个而另一个表视图停止滚动时。我希望如果我拖动一个表视图,另一个应该是按预定的时间间隔滚动。