OGeek|极客世界-中国程序员成长平台

标题: ios - 双击栏按钮项目滚动到顶部 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 18:16
标题: ios - 双击栏按钮项目滚动到顶部

当我双击任何 BarButtonItem 时,我想滚动到顶部。 我在 stackOverflow 上看到了很多答案,但没有一个对我有用。 也许我用错了?我将代码放在 AppDelegateTableViewControllers 我想专门添加此功能的哪里?

无论如何,我正在使用 Swift 2.3 和 Xcode 8,很想得到一些帮助。

谢谢。



Best Answer-推荐答案


你知道 scrollsToTop 吗?我认为这是你需要的。 iOS SDK 中与 UIScrollView 中的 scrollsToTop 属性相关的说明:

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.

关于ios - 双击栏按钮项目滚动到顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40958398/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4