当用户向下滚动75%时,在uiscrollview中自动回发

时间:2015-09-28 13:04:55

标签: ios objective-c swift

如何检查用户是否向下滚动75%?我想实现一个回发来加载更多的数据,但我不知道如何实现这个...如果有人能指出我正确的方向或展示一些示例代码,我将不胜感激?

1 个答案:

答案 0 :(得分:1)

First you need to set your scrollview delegate. And on scrollViewDidScroll method you need to calculate scroll position. This should cover your goals

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if ((scrollView.contentOffset.y + scrollView.bounds.size.height)/scrollView.contentSize.height) > 0.75) {
        // do stuff
    }

}