检测 UIScrollView 何时在某个点查看并执行操作

发布于 2024-11-02 20:49:54 字数 552 浏览 2 评论 0原文

我正在尝试弄清楚如何做到这一点。已经被困在这个问题上很长一段时间了。我试图检测 UIScrollView 何时处于完美位置并执行操作。这里我有一个 UIScrollView 与里面的图像对齐,如下所示。 http://cl.ly/66yW 现在,如果您看第一张图片上方,会看到一个小三角形。该三角形指示将执行什么操作,或者仅指示将使用哪种 URL 缩短服务。现在,当用户滚动到下一个服务时,我想将该服务设置为将缩短 URL 的服务。 http://cl.ly/67cA

我该如何执行此操作? 欢迎任何完成此操作的代码或链接。

谢谢

编辑: 好的,所以我认为要获得捕捉效果,我需要启用分页。现在,我是否可以像图片中那样为每个页面设置自己的服务,并将它们全部签名,以便用户可以看到服务从屏幕上消失,就像我在图片中一样?比如,Rfly.Me 是一个页面,CloudApp 是另一个页面等等,但它们的布局是否与上图所示完全一致?

I'm trying to figure out how to do this. Been stuck on this for a really ling time. I'm trying to detect when a UIScrollView is in a perfect location and perform an action. Here I have a UIScrollView aligned with images inside like this. http://cl.ly/66yW now if you look above the first image there is a little triangle. That triangle indicates what action will be performed or only case which URL shortening service will be used. Now when the user scrolls to the next one I'd like to set that service as the service which the URL will be shortened with. http://cl.ly/67cA

How do I go about doing this?
Any code or links to complete this are welcomed.

Thanks

Edit:
Okay So I gather to get that snapping effect I need paging enabled. Now is it possible for me to set each page its own service like I have in the pictures and keep them all signed lie that so the user can see services fade off the screen like I have it? So like, Rfly.Me is one page, CloudApp is another etc etc etc but also have them lay out exactly as they are shown in the pictures above?

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

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

发布评论

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

评论(2

内心激荡 2024-11-09 20:49:55

这是一个详细说明(主要)您要查找的内容的示例:

http ://code.davidjanes.com/blog/2009/09/26/uipagecontrol-uiscrollview/

编辑:刚刚找到一个可以完成您正在查找的操作的嵌入式类 为了。我只是将其发布在这里以供将来参考:

http://cocoacontrols.com/platforms/ios/控件/v8horizo​​ntalpickerview

Here's an example that details (mostly) what you're looking for:

http://code.davidjanes.com/blog/2009/09/26/uipagecontrol-uiscrollview/

Edit: Just found a drop-in class that does what you're looking for. I'm just posting this here for future reference:

http://cocoacontrols.com/platforms/ios/controls/v8horizontalpickerview

国际总奸 2024-11-09 20:49:55

我认为你可以使用:

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView

然后检查scrollView.contentOffset.x并将其与云的位置进行比较。

您可能会发挥创意,如果偏移量在云位置的 +/-10 之间,则会自动将自身动画化为“单击”到云上方的位置

I think you can use:

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView

And then check the scrollView.contentOffset.x and compare it to the position of your cloud.

You might get creative so that if the offset is between +/-10 of the cloud position is automatically animates itself to "click" into position above the cloud

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