UITableView delegate action when tableView is scrolled?
Asked Answered
L

2

26

Is there a UITableView delegate-action that runs when the tableView is being scrolled?

This is probably really easy, but I can't find it.

Thank you :)

Loreeloreen answered 19/8, 2010 at 10:35 Comment(0)
G
57

UITableView is a subclass of UIScrollView and table's delegate can also act as a scroll view's delegate. So you can use all methods from UIScrollViewDelegate for your table (implementing them in table's delegate), e.g.

- (void)scrollViewDidScroll:(UIScrollView *)scrollView

(scrollView parameter in this case will be pointer to your tableview)

Goldoni answered 19/8, 2010 at 10:42 Comment(1)
Sorry for not accepting earlier, I completely forgot about this! Thanks, though, it worked :)Loreeloreen
B
5

Swift 4

override func scrollViewDidScroll(_ scrollView: UIScrollView) {
    print("I'm scrolling!")
}
Bauble answered 29/9, 2017 at 11:25 Comment(1)
print("And my vertical offset is \(scrollView.contentOffset.y)!")Recognize

© 2022 - 2024 — McMap. All rights reserved.