UITableView not executing to scrollViewDidScroll or scrollViewShouldScrollToTop

Anand picture Anand · Jan 15, 2011 · Viewed 8.6k times · Source

I have a private table view in my UIViewController as follows

 UIViewController<UIScrollViewDelegate, UITableViewDelegate> {

 @private
   UITableView *gTableView;
...
}

in my implementation i have set

gTableView.delegate=self;
gTableView.dataSource=self;

EDIT

The scrollViewWillBeginDecelerating and scrollViewDidScroll delegates are getting called but not the scrollViewDidScrollToTop.

What am I doing wrong now?

Answer

Jesse Gumpo picture Jesse Gumpo · Jan 15, 2012

When used with a TableView, scrollViewDidScrollToTop only gets called with a scroll-to-top gesture (a tap on the status bar). Try using scrollViewDidEndDragging or scrollViewDidEndDecelerating to detect if scrollView.contentOffset.y is <= 0