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 604

    ArtOfWarfare

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

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

    Code:
    - (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.)

    Suggestions?
     
  2. Sykte macrumors regular

    Joined:
    Aug 26, 2010
    #2
    Are you ever calling any of these?

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

    ArtOfWarfare thread starter macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #3
    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