SetNeedsDisplayInRect 未立即生效

发布于 2024-09-08 12:10:27 字数 330 浏览 1 评论 0原文

当我调用 setNeedsDisplayInRect: 时,为什么我的 drawRect:inContext 方法没有很快被调用?如果我放大未绘制的区域,然后缩小(我猜会触发重新绘制),则会绘制图像。但如果我把它放在那里,就没有骰子。有没有办法立即强制重画?

以防万一,我确实使用了 MapKit 的叠加层以及 setNeedsDisplayInMapRect:zoomScale:drawMapRect:zoomScale:inContext: 方法,但我之前遇到过这个问题一个滚动视图和一个CATiledLayer。

When I call setNeedsDisplayInRect:, why isn't my drawRect:inContext method being called soon after? If I zoom into the unpainted area, then zoom out (I guess triggering a repaint) the image will be drawn. But if I leave it sitting there, no dice. Is there a way to force a repaint immediately?

Just in case it matters, I'm really using MapKit's overlays and the setNeedsDisplayInMapRect:zoomScale: and drawMapRect:zoomScale:inContext: methods, but I had this problem previously with just a scrollview and a CATiledLayer.

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

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

发布评论

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

评论(1

自由如风 2024-09-15 12:10:27

你不应该使用

  • (void)drawMapRect:(MKMapRect)mapRect
    缩放比例:(MKZoomScale)缩放比例
    inContext:(CGContextRef)上下文

不是drawRect:inContext:

shouldn't you be using

  • (void)drawMapRect:(MKMapRect)mapRect
    zoomScale:(MKZoomScale)zoomScale
    inContext:(CGContextRef)context

not drawRect:inContext:

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