1

I know how to manually scroll a UITableViewor UIScrollView to top.

I am trying to replicate the behaviour of tapping the UIStatusBar which automatically finds the active view that can be scrolled to top and scrolls it to top.

So, I want to do the same, without knowing which UIScrollView subclass is currently active and can be scrolled to top.

Is there a public NSNotification for this, or any other public method?

frankish
  • 6,738
  • 9
  • 49
  • 100

1 Answers1

0

[self.scrollView setContentOffset:CGPointZero animated:YES];

Update You should traverse view hierarchy or responder chain and the first item of class UIScrollView that responds with YES to scrollsToTop (or if delegate implements scrollViewShouldScrollToTop: and returns YES) will be your candidate for automatic scrolling

Sash Zats
  • 5,376
  • 2
  • 28
  • 42
  • Thank you for your answer but as I have noted in my question. I aldready know how to scroll a "specific" scrollview. I am trying to mimic the behaviour of tapping to Status Bar. I have to do this without specifically callinga known scrollview. – frankish May 17 '14 at 16:08
  • oh sorry, missed that, fixed my answer. – Sash Zats May 17 '14 at 16:09