40

I have a UITableView instance variable. I want to be able to register my view controller to be the UIScrollViewDelegate for my UITableViewController. I have already tried

tableView.delegate = self;

But when scrolling, my methods

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView            
                  willDecelerate:(BOOL)decelerate

don't get called. Any suggestions?

Daniel
  • 23,129
  • 12
  • 109
  • 154
Brian
  • 3,571
  • 7
  • 44
  • 70

3 Answers3

134

Now UITableViewDelegate conforms to UIScrollViewDelegate !

(I write this answer because many people are going to find this page googling..)

Daniel
  • 23,129
  • 12
  • 109
  • 154
Francescu
  • 16,974
  • 6
  • 49
  • 60
7

UITableViewDelegate will implement UIScrollViewDelegate protocol also.

wxactly
  • 2,400
  • 1
  • 26
  • 42
5

This is officially unsupported. UITableView and UIWebView do not expose their internally managed scrollviews.

You can descend into the subview hierarchy and make undocumented calls, but that's not recommended, as it's officially prohibited and can break under future OS versions if the underlying (undocumented) API changes.

Daniel
  • 23,129
  • 12
  • 109
  • 154
Marco
  • 14,977
  • 7
  • 36
  • 33
  • I was afraid this was the case. Thanks. – Brian Oct 23 '09 at 20:10
  • 3
    As santoni's answer below indicates, `UITableViewDelegate` conforms to `UIScrollViewDelegate` (this may have changed in an SDK release?), which means that all `UIScrollViewDelegate` messages will get passed to the `UITableView`'s delegate. – Nick Forge Jul 09 '10 at 09:33
  • a uitableview is a uiscrollview – marchinram Mar 20 '13 at 08:50