SetNeedsDisplayInRect 未立即生效
当我调用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不应该使用
缩放比例:(MKZoomScale)缩放比例
inContext:(CGContextRef)上下文
不是drawRect:inContext:
shouldn't you be using
zoomScale:(MKZoomScale)zoomScale
inContext:(CGContextRef)context
not drawRect:inContext: