如何在滚动时重绘视图?

发布于 2024-10-03 07:51:25 字数 564 浏览 0 评论 0原文

我有一个 UIScrollView。此滚动视图滚动我的自定义 GameView。当我将 setNeedsDisplay 发送到我的 GameView 时,它会重绘并且一切正常。

除非我正在滚动 GameView。在滚动停止之前它不会重绘。

有没有什么办法可以绕过这个问题,并在滚动过程中强制查看?

顺便说一句,我已经发现了这些问题,但它们没有帮助:
UIScrollView 暂停 NSTimer 直到滚动完成
怎么做当用户滚动 UIScrollView 时,我让 UIView 重绘

I have a UIScrollView. This scroll view scrolls my custom GameView. When I send setNeedsDisplay to my GameView, it redraws and everything goes fine.

Except when I'm in the middle of scrolling GameView. It does not redraw until the scrolling has stopped.

Is there any way to circumvent this and just force the view during the scroll?

By the way, I already found these questions, but they didn't help:
UIScrollView pauses NSTimer until scrolling finishes
How do I get my UIView to redraw while the user is scrolling a UIScrollView

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

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

发布评论

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

评论(1

原谅我要高飞 2024-10-10 07:51:25

尝试在 setNeedsDisplay 之后立即发送视图层 displayIfNeeded

Try sending the view's layer displayIfNeeded immediately after setNeedsDisplay.

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