Become UIScrollViewDelegate delegate for UITableView
Asked Answered
P

3

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?

Peroxidase answered 23/10, 2009 at 19:7 Comment(0)
W
134

Now UITableViewDelegate conforms to UIScrollViewDelegate !

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

Winonawinonah answered 6/5, 2010 at 13:9 Comment(2)
I don't think is NOW, is just that it is.Enterectomy
It's NOW maybe because in 2009 UITableViewDelegate didn't conform to UIScrollViewDelegate ;)Winonawinonah
I
7

UITableViewDelegate will implement UIScrollViewDelegate protocol also.

Infighting answered 29/9, 2010 at 9:35 Comment(0)
L
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.

Longplaying answered 23/10, 2009 at 20:6 Comment(3)
I was afraid this was the case. Thanks.Peroxidase
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.Finnougric
a uitableview is a uiscrollviewPaucity

© 2022 - 2024 — McMap. All rights reserved.