多少人知道ios app里点击屏幕上边沿让页面滚回顶部

2024-11-25 06:10:36
推荐回答(2个)
回答1:

UIScrollView和其子类都具有点击状态栏直接回到顶部的功能, 不用自己写.
// When the user taps the status bar, the scroll view beneath the touch which is closest to the status bar will be scrolled to top, but only if its `scrollsToTop` property is YES, its delegate does not return NO from `shouldScrollViewScrollToTop`, and it is not already at the top.
// On iPhone, we execute this gesture only if there's one on-screen scroll view with `scrollsToTop` == YES. If more than one is found, none will be scrolled.
@property(nonatomic) BOOL scrollsToTop __TVOS_PROHIBITED; // default is YES.

这是官方的解释, 自带的功能.不用自己写

回答2:

早就知道了啊