I need to detect when a CATiledLayer has finished drawing. I tried subclassing and overriding -(void)display
to set/clear a flag, but it seems that tile drawing is happening in a different thread (display just returns and then seconds later, the layer is finished drawing)
我需要检测CATiledLayer何时完成绘图。我尝试了子类化和覆盖 - (void)显示来设置/清除一个标志,但似乎瓷砖绘图发生在另一个线程中(显示只返回,然后几秒钟后,图层完成绘图)
1 个解决方案
#1
Some things are not clear from your question. Are you asking whether all tiles have been drawn or just whether the visible tiles have finished drawing?
你的问题有些不清楚。您是在询问是否已绘制所有瓷砖或仅查看可见瓷砖是否已完成绘图?
Assuming the later you could try drawInContext: but will likely still not give you the answer if there is scrolling. Because the tiles are cached and we have no way to know when the cached tiles are dumped you would not be able to tell if a tile has not been drawn yet or if it was just drawn from the cache.
假设后者你可以尝试drawInContext:但如果有滚动,可能仍然不会给你答案。因为磁贴已缓存,我们无法知道何时转储缓存的磁贴,您将无法判断磁贴是否尚未绘制,或者是否仅从缓存中绘制。
You might want to describe what you are trying to accomplish and see if people have ideas for another way to do it.
您可能想要描述您要完成的任务,并了解人们是否有其他方法可以实现这一目标。
#1
Some things are not clear from your question. Are you asking whether all tiles have been drawn or just whether the visible tiles have finished drawing?
你的问题有些不清楚。您是在询问是否已绘制所有瓷砖或仅查看可见瓷砖是否已完成绘图?
Assuming the later you could try drawInContext: but will likely still not give you the answer if there is scrolling. Because the tiles are cached and we have no way to know when the cached tiles are dumped you would not be able to tell if a tile has not been drawn yet or if it was just drawn from the cache.
假设后者你可以尝试drawInContext:但如果有滚动,可能仍然不会给你答案。因为磁贴已缓存,我们无法知道何时转储缓存的磁贴,您将无法判断磁贴是否尚未绘制,或者是否仅从缓存中绘制。
You might want to describe what you are trying to accomplish and see if people have ideas for another way to do it.
您可能想要描述您要完成的任务,并了解人们是否有其他方法可以实现这一目标。