0

I have a UITableView within my UIViewController.

I want the table to scroll to the top when the status bar is pressed. i've tried self.tableView.scrollsToTop = YES but it does not scroll the table to the top.

Any idea on how to make this work?

3254523
  • 3,016
  • 7
  • 29
  • 43

1 Answers1

1

Looking at the documentation for UIScrollView, scrolls to top, there is a special consideration: "on iPhone, the scroll-to-top gesture has no effect if there is more than one scroll view on-screen that has scrollsToTop set to yes."

This could be part of the issue, without seeing your actual code.

Another technique you might employ since it sounds like a uitableview nested inside a view controller, is to call scrollToRowAtIndexPath:atScrollPosition:animated:

So, detect when status bar is pressed, then call [YourTable scrollToRowAtIndexPath:probably0 atScrollPosition: UITableViewScrollPositionTop animated:YES/NO];

timothykc
  • 2,235
  • 1
  • 16
  • 14
  • thanks for your answer, would scrollViewShouldScrollToTop detect when a status bar is pressed? – 3254523 Jun 13 '14 at 17:45
  • Here are some approaches to the problem of knowing when a user taps the status bar http://stackoverflow.com/questions/3753097/how-to-detect-touches-in-status-bar – timothykc Jun 13 '14 at 17:48