开发者

scrollViewWillBeginDecelerating alternative, too slow for tracking page change

I am currently using pagination in a UIScrollView, and for tracking any page change I use;

-(void) scrollViewWillBeginDecelerating:(UIScrollView *)scrollView
{
    if (_previousContentOffset > _pageContainer.contentOffset.x)
    {
        NSLog(@"Less");
        _currentPageIdx--;
    }
    else if (_previousContentOffset < _pageContainer.contentOffset.x) 
    {
        _currentPageIdx++;
        NSLog(@"More开发者_运维百科");
    }
}

Now the problem is that, this method isn't tracking the touch fast enough, so when this method is called, the user can be 3 pages along if he/she is paging like a maniac. I tried setting

_pageContainer.decelerationRate = UIScrollViewDecelerationRateFast;

but that didn't make the tracking much faster.

Is there a solution or alternative for this?


Use scrollViewDidScroll: instead. It is being called continuously while the user scrolls.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜