Scrolling UITableViewController


I want to be able to scroll my table. From the docs, I know that UITableViewController conforms to the UIScrollViewDelegate protocol, so I should be able to override this function

  • (void)scrollViewDidScroll: (UIScrollView*)scrollView


I’m drawing blanks on what code to put in. I’ve googled.



Sadly no replies yet.

All I’m doing now is printing a log inside the function, and I’m not even printing that.

I added a UIScrollView property in ItemsViewController and did this in Homepwner::didFinishLaunchingWithOptions()

   // sv is the UIScrollView property in ItemsViewController class
    CGRect rect = [[self window] bounds];
    CGRect bigRect = rect;
    bigRect.size.height *= 2.0;
    ItemsViewController *ivc = [[ItemsViewController alloc] init]; = YES; = bigRect.size;
    ivc.tableView.frame = rect;
    [ivc.tableView removeFromSuperview];
    [ addSubview:ivc.tableView];
    ivc.view =; = ivc;
    self.window.rootViewController = ivc;

I see the table and its contents, but app is NOT responding to scrolling, that is, log in scrollViewDidScroll function is not printed.


The UITableView is a UIScrollView, so you shouldn’t have to add another UISCrollView to the screen.

Since the UITableViewController is the delegate for the UITableView (which makes it the delegate for its UIScrollView methods, too), any scrolling that takes place in the table view will send UIScrolViewDelegate messages to your table view controller.

By creating another UIScrollView and adding the table view to the scroll view, you’ve set it up where the scroll view itself won’t scroll, but the table within it well.

You should be able to remove the UIScrollVIew altogether and then implement scrollViewDidScroll: in ItemsViewCOntroller.m


Yes I see now, thanks. I removed all that code and it worked.