菜鸟教程小白 发表于 2022-12-11 18:16:31

ios - 双击栏按钮项目滚动到顶部


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

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

<p>谢谢。 </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>你知道 <code>scrollsToTop</code> 吗?我认为这是你需要的。 iOS SDK 中与 <code>UIScrollView</code> 中的 <code>scrollsToTop</code> 属性相关的说明:</p>

<blockquote>
<p>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 <code>scrollsToTop</code> property is YES, its delegate does not return NO from <code>shouldScrollViewScrollToTop</code>, and it is not already at the top.
      // On iPhone, we execute this gesture only if there&#39;s one on-screen scroll view with <code>scrollsToTop</code> == YES. If more than one is found, none will be scrolled.</p>
</blockquote></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 双击栏按钮项目滚动到顶部,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/40958398/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/40958398/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 双击栏按钮项目滚动到顶部