UITableView scroll to top when tapping status bar at top of the screen

后端 未结 2 590
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-25 08:52

I inserted a UITableView inside another UIViewController\'s view. but when I tap the status bar at the top of the screen; the table view doesn\'t s

2条回答
  •  抹茶落季
    2020-12-25 09:51

    You have to set scrollsToTop to NO on all the other scroll views in your hierarchy. If more than one scroll view has scrollsToTop set to YES, none of them will scroll to top when the status bar is touched. This is mentioned in the documentation of the scrollsToTop property.

    Keep in mind that this also applies to any subclasses of UIScrollView in your view hierarchy, and that UITableView, UIContainerView, and UITextView are subclasses of UIScrollView.

提交回复
热议问题