Resolved ScrollsToTop not working?

Discussion in 'iOS Programming' started by ArtOfWarfare, Dec 1, 2011.

  1. ArtOfWarfare, Dec 1, 2011
    Last edited: Dec 14, 2011

    ArtOfWarfare macrumors G3


    Nov 26, 2007
    When the app first starts I make sure only one scroll view responds to this, like this:

    tableView.scrollsToTop = YES;
    keyboard.scrollsToTop = NO;
    And then in the delegate for my tableView I have this:

    - (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView
        NSLog(@"Asked whether the scroll view should scroll to top.");
        return YES;
    The NSLog is not being recorded, which means the fact I've touched the status bar isn't making it to the delegate.

    I know that my delegate is set up properly because it responds to other delegate methods properly (like whether or not rows should be allowed to be moved.)

  2. Sykte macrumors regular

    Aug 26, 2010
    Are you ever calling any of these?

    – scrollToRowAtIndexPath:atScrollPosition:animated:
    – scrollToNearestSelectedRowAtScrollPosition:animated:
    – scrollRectToVisible:animated:
  3. ArtOfWarfare, Dec 2, 2011
    Last edited: Dec 14, 2011

    ArtOfWarfare thread starter macrumors G3


    Nov 26, 2007
    Yes, why? Does using any of those somehow prevent scroll to top from working?

    Edit two weeks later:

    I found the issue... I have three scroll views, I was only disabling scrollsToTop for two of them. I'd completely forgotten about the third scroll view because it only becomes visible when the user enters text of sufficient length (like the iMessages app.)

Share This Page