scrollToRowAtIndexPath:atScrollPosition:动画滚动太慢 [英] scrollToRowAtIndexPath:atScrollPosition:animated scrolling too slow

查看:146
本文介绍了scrollToRowAtIndexPath:atScrollPosition:动画滚动太慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于页面滚动UIScrollView的页面更改,我正在调用scrollToRowAtIndexPath:atScrollPosition:animated来显示该页面的表详细信息.

Based on the page change of a paged UIScrollView, I'm calling scrollToRowAtIndexPath:atScrollPosition:animated to the table specifics for that page that's in display.

- (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];
}

但是,自动滚动的动画发生得太慢.有没有办法使这个动画更加生动?

However, the animation of the automatic scrolling is happening too slow. Is there a way to make this animation more snappy?

推荐答案

一个快速的解决方案可能是:

A fast solution might be:

[UIView animateWithDuration:aSmallValue animations:^{
        [self.tableView scrollToRowAtIndexPath:indexPath
                              atScrollPosition:UITableViewScrollPositionTop 
                                      animated:NO];
}];

这篇关于scrollToRowAtIndexPath:atScrollPosition:动画滚动太慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆