9

When I tap on the status bar, the UIScrollView in my app does not respond and scroll to the top. Nothing happens. What could cause the UIScrollView to ignore taps on the status bar?

Jack Humphries
  • 13,056
  • 14
  • 84
  • 125

3 Answers3

14

This can occur when there are multiple instances of UIScrollView (or a subclass of UIScrollView, such as UITableView) with the scrollsToTop property set to YES on the same view, such as when a UIScrollView is added as a subview to a UIScrollView. Make sure that the scrollsToTop property of only one scroll view is set to YES. The correct UIScrollView should respond to tap events on the status bar after.

Jack Humphries
  • 13,056
  • 14
  • 84
  • 125
  • 2
    It is actually the case that if there is more than one `UIScrollView` with `scrollsToTop` set to `YES` on screen at any time, none of them will scroll to top via the status bar, regardless of their relative positions in the view hierarchy. – ianyh Aug 22 '13 at 02:08
4

Like Jack said, you can only have one subclass of UIScrollView (usually the table view) that has the scrollsToTop property set to YES. Likely you have others, typically UITextView in your view. Just set their scrollsToTop property to NO and you're good to go.

Vojtech Vrbka
  • 5,342
  • 6
  • 44
  • 63
George
  • 2,187
  • 2
  • 17
  • 11
0

Also check scrollsToTop in all container views if you have ones.

Petr Syrov
  • 14,689
  • 3
  • 20
  • 30