Why doesn't UIScrollView/UITableview respond t

2019-06-16 05:27发布

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?

3条回答
劫难
2楼-- · 2019-06-16 06:07

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

查看更多
迷人小祖宗
3楼-- · 2019-06-16 06:16

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.

查看更多
Viruses.
4楼-- · 2019-06-16 06:17

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.

查看更多
登录 后发表回答