4

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?

Community
  • 1
  • 1
Anand
  • 4,182
  • 6
  • 42
  • 54
  • 1
    Shouldn't you be implementing `UITableViewDataSource` too? Also `UITableViewDelegate` itself conforms to `UIScrollViewDelegate`. – BoltClock Jan 15 '11 at 07:58
  • ya i am .. just for SO purpose i gave only the required delegates.. here's what I am implementing :UIActionSheetDelegate, UIScrollViewDelegate, UINavigationBarDelegate, UITableViewDelegate, UITableViewDataSource – Anand Jan 15 '11 at 13:48
  • well thanks... i guess that was the mistake then.. i shouldn't have implemented both... removing the scroll delegate is now calling "scrollViewDidScroll" but not calling "scrollViewDidScrollToTop" which is not good for me.. any ideas? – Anand Jan 15 '11 at 14:05

1 Answers1

7

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

axel22
  • 32,045
  • 9
  • 125
  • 137
Jesse Gumpo
  • 4,777
  • 1
  • 20
  • 29