If you implement the UITableViewDelegate
protocol, you can also implement one of the UIScrollViewDelegate
methods:
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
or
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
For example, if you have a property called tableView
:
// ... setting up the table view here ...
self.tableView.delegate = self;
// ...
// Somewhere in your implementation file:
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
NSLog(@"Will begin dragging");
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
NSLog(@"Did Scroll");
}
This is because UITableViewDelegate
conforms to UIScrollViewDelegate
, as can be seen in the documentation or in the header file.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…