Search code examples
iosuitableviewuiscrollviewdelegate

How to use UIScrollViewDelegate methods on a tableView added to a UIViewController?


how could we use the UIScrollViewDelegate methods on a tableView that is added to a UIViewController? It works fine when I subclass the UITableViewController, but in my case, the tableView is added inside a UIViewController. The delegate and datasource are linked to self, I added UIScrollViewDelegate as a protocol, but the delegate methods are not recognized by the viewController.

Thanks


Solution

  • UITableViewDelegate inherits from UIScrollViewDelegate. If you determine that object is delegate of table view, it would be also a delegate of scrollView.