如何在滚动时重绘视图?
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在
setNeedsDisplay
之后立即发送视图层displayIfNeeded
。Try sending the view's layer
displayIfNeeded
immediately aftersetNeedsDisplay
.