我已经设置scrollView
委托并将逻辑实现到scrollViewDidScroll协议方法如下,它永远不会进入第二个条件。我想知道我错过了什么?
-(void)scrollViewDidScroll: (UIScrollView*)scrollView
{
float scrollViewHeight = scrollView.frame.size.height;
float scrollOffset = scrollView.contentOffset.y;
if (scrollOffset == 0)
{
// then we are at the top
}
else if (scrollOffset + scrollViewHeight == 700.0)
{
// never calls here
[self loadSecondFromURL];
}
}
答案 0 :(得分:1)
我认为scrollOffset为零,因此只进入第一个循环。我改变了这样的代码,它对我来说很好用
if (scrollOffset == 0)
{
// then we are at the top
}
if (scrollOffset + scrollViewHeight == 700.0)
{
// never calls here
[self loadSecondFromURL];
}