-1

I want to know this override function named "scrollViewDidScroll"means because i am now currently stuck at that which that doesn't work.Here is my code.I really want to know each steps by steps of the code i describe below.

override func scrollViewDidScroll(scrollView: UIScrollView) {
    // UITableView only moves in one direction, y axis
    let currentOffset = scrollView.contentOffset.y //?
    let maximumOffset = scrollView.contentSize.height - scrollView.frame.size.height //?
    // Change 10.0 to adjust the distance from bottom
        if (maximumOffset - currentOffset) <= 40.0 { //?
            loadSegment(currentPage, count: currentCount) // This is the function that load 15 results per page each call from api. 
        }
}

I am now currently stuck at page 2 with "Loading" when i scroll down after getting 30 results which mean this method is not working after i scroll first from page 2.When i scroll down from page 2 to get more results,it stuck at loading which mean this method dont work.So loadSegment don't call because it dont pass to if condition.

Any help with code explanation?Thank You

Thiha Aung
  • 5,036
  • 8
  • 36
  • 79

1 Answers1

1

If scrollViewDidScroll isn't firing, you should probably check if tableview.delegate = self; or tableview.delegate = // whichever class scrollViewDidScroll is in Have you put an NSLog in scrollViewDidScroll?

Magoo
  • 2,552
  • 1
  • 23
  • 43