根据分页UIScrollView的页面更改,我打电话给scrollToRowAtIndexPath:atScrollPosition:animated
查看显示的页面的表格细节。scrollToRowAtIndexPath:atScrollPosition:动画滚动速度太慢
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
CGFloat pageWidth = self.scrollView.frame.size.width;
int page = floor((self.scrollView.contentOffset.x - pageWidth/2)/pageWidth)+1;
self.pageControl.currentPage = page;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:page];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
但是,自动滚动的动画发生得太慢。有没有办法让这个动画更加活泼?
你谈论的设备或模拟器上运行? –
这两个动画都很慢。 –
尝试使用不带动画的“scrollToRowAtIndexPath”,并将该行添加到可为其设置动画持续时间的“UIView”动画块中。 – danypata