casillas
casillas

Reputation: 16793

scrollViewDidScroll does not go into the condition

I have setup scrollView delegate and implemented the logic into scrollViewDidScroll protocol method as follows, it never goes into the second condition. I wonder what I am missing?

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

Upvotes: 1

Views: 68

Answers (1)

Saiteja
Saiteja

Reputation: 71

I think scrollOffset is zero so, its entering only first loop. I changed the code like this and it works fine for me

if (scrollOffset == 0)
{
    // then we are at the top
}

if (scrollOffset + scrollViewHeight == 700.0)
{
   // never calls here 
   [self loadSecondFromURL];
}

Upvotes: 1

Related Questions