如果实现UITableViewDelegate
协议,还可以实现UIScrollViewDelegate
种方法之一:
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
或
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
F或 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
conf或ms to UIScrollViewDelegate
, as can be seen in the documentation 或 in the header file.