目标 C:返回第 1 页按钮

发布于 2025-01-04 08:10:34 字数 123 浏览 4 评论 0原文

我有一个包含 25 页的滚动视图(已启用分页),我想在每个页面中放置一个“返回第 1 页”按钮,我该如何做到这一点?听起来很容易,但我不知道。

很抱歉问这样的问题,我知道这里很多人都比我更先进,我只是在寻求一些帮助。

I have a scrollview with 25 pages (pagingEnabled) and i want to put a "Back to Page 1" Button in each page, how will i able to do that? it sounds easy but i have no idea.

sorry for asking this kind of question i know a lot of people here are more advanced than me, i'm just looking for some help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

猫瑾少女 2025-01-11 08:10:34

要返回第一页,只需将代码:

scrollView.contentOffset = CGPointZero;

附加到按钮对应的 IBAction 方法即可。

To go back to the first page, just attach the code:

scrollView.contentOffset = CGPointZero;

to the IBAction method corresponding to the button.

伪心 2025-01-11 08:10:34

请参阅 NSView 的 -scrollRectToVisible: 方法。

See NSView's -scrollRectToVisible: method.

○闲身 2025-01-11 08:10:34

您的按钮操作只需说明

scrollView.contentOffset = CGPointZero;

Your button action just needs to say

scrollView.contentOffset = CGPointZero;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文