使用 UiScrollview 分页并渲染下一页

发布于 2024-10-20 15:46:49 字数 328 浏览 4 评论 0原文

根据 PhotoScroller 示例,我已经实现了带有分页的 UIScrollView。

但是,我无法让它很好地工作。我使用加载 XIB 的 viewController。但是,当滚动页面时,直到它完全在视图中时才会真正更新(因此它似乎不会用数据渲染布局,直到它完全在视图中)

我在 Loadview 上加载数据(因为 viewWillAppear 似乎永远不会被调用 )在这种情况下)。 有什么建议我如何在创建视图时呈现整个视图,以便在滚动到它时显示它?我不知所措,认为我几乎尝试了所有方法(除了明显的可能)。

(编辑:加载的视图存储在可变字典中,以便在向后滚动时调用,并且它们是正确的)

I have implemented the UIScrollView with pagination, according to the PhotoScroller example.

However, I cannot get it to work nicely. I use an viewController which loads an XIB. But when scrolling the page does not actually update until it is complete in view (so it doesn't seem to render the layout with the data until it is completely in view)

I load the data on Loadview (as viewWillAppear never seems to be called in this scenario).
Any suggestions how I can have the whole view rendered when it is created so it shows while scrolling towards it? I am at a loss and think I tried almost everything (except the obvious probably).

(edit: the views that were loaded are stored in a mutable dictionary for recall when scrolling back, and they for correctly)

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

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

发布评论

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

评论(1

喵星人汪星人 2024-10-27 15:46:49

我解决这个问题的方法是实现示例应用程序,而不是在滚动开始时仅加载当前页面周围的页面,而是预加载周围的页面。这看起来很完美。

The way I solved it was to implement the example App and instead of only loading the pages around the current page when scrolling starts, to preload the pages around. That seems to work perfect.

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