uiscrollview在减速时留在内存中

发布于 2025-02-05 16:56:48 字数 298 浏览 2 评论 0原文

我注意到一个小的内存泄漏问题,我想知道是否有一种防止它的方法。

如果您的卷轴浏览较长(例如tableview),并且向下滑动它会在停止之前持续一段时间(即惯性)。

现在,我注意到,如果您在ScrollView仍在降低卷轴时关闭ViewController,则直到(实际上)停止滚动才会降低卷轴。我注意到这永远不会超过1秒钟。

也许没什么大不了的,但是我仍然很好奇是否可以解决。我尝试在ViewDiddisAppear()和许多其他事情中停止滚动,但没有运气:(。

此问题似乎不适用于iOS 12,但它适用于iOS 14和15。

I noticed a small memory leak issue and I'm wondering if there is a way to prevent it.

If you have a long ScrollView (like TableView) and you swipe down it will keep scrolling for a while before it stops (i.e. inertia).

Now I noticed that if you close the ViewController while the ScrollView is still decelerating the ScrollView won't deinit until it (virtually) stopped scrolling. I noticed that this never takes more than 1 second.

Well no big deal maybe, but still I'm curious if this can be fixed. I tried stopping the scrolling in viewDidDisappear() and many other things but no luck :(.

This issue doesn't seem to apply to iOS 12, but it does to iOS 14 and 15.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文