用于类似白板的应用程序的无限 UIScrollView

发布于 2024-09-26 18:11:06 字数 303 浏览 1 评论 0原文

当然,之前已经有人问过“无限”UIScrollView 问题,但它似乎总是与这种场景相关:

“旋转木马”上有 4 个卡子视图的滚动视图,即到达第四张卡,然后朝继续将再次产生第一张卡(因此无需向后滚动)。

我需要帮助的是 popplet.com 的人们在他们的 iPad 应用程序上实现的内容,当您向任何方向(无限/无限)滚动时,画布会调整大小,从而允许几乎无限的小部件放置。

我知道这涉及某种 KVO 观察,但我有点迷失了。我的总体想法是将主要 contentView 放置在滚动视图中,然后将所有其他视图放置在其中(这些是可以拖动的视图等)

Naturally an "infinite" UIScrollView question has been asked about before, but it always seem to be related to this sort of scenario:

A scrollview with 4 card subviews on a "carousel", i.e. reaching the 4th card and then swiping in the direction of continuation would yield the 1st card again (and therefore no need to scroll backwards).

What I want help with is what the folks at popplet.com implemented on their iPad app, as you scroll in any direction (which is unlimited/infinite) the canvas resizes allowing for practically infinite widget placement.

I know this involves some sort of KVO observing but I'm a bit lost. My general idea is to have a main contentView placed within the scrollview and then all other views are placed inside that (those are the ones that can be dragged, etc.)

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

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

发布评论

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

评论(1

青萝楚歌 2024-10-03 18:11:06

无需下载应用程序并仔细查看它,您也许可以使用委托回调

- (void)scrollViewDidScroll:(UIScrollView *)scrollView;

,并且当滚动视图接近结束时增加滚动视图的 contentSize 属性。然后,当用户向后滚动时调用它时,您可以检查那里是否绘制了任何内容并根据需要减少它。只需使用scrollView的contentOffset属性来检查用户在scrollView中的位置。

正如我所说,这只是一个有根据的猜测,但鉴于您的详细信息,这就是我处理问题的方式

Without downloading the app and having a good look at it you might be able to use the delegate call back

- (void)scrollViewDidScroll:(UIScrollView *)scrollView;

and when the scrollView is close to end increase the contentSize property of scrollView. Then when it gets called as the user scrolls back you could possible check if anything is drawn there and decrease it as necessary. Just use the contentOffset property of scrollView to check where the user is in the scrollView.

Just an educated guess as I said but thats the way I would approach it given your details

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