两个可见的 CATiledLayers 导致问题!

发布于 2024-10-28 16:28:01 字数 626 浏览 0 评论 0原文

其他人也遇到过这个问题,但我还没有看到任何解决方案 - 请参阅( http://openradar.appspot .com/6941930)。

我有一个 UIScrollView,其内容视图的图层包含两个 CATiledLayers。一个平铺层绘制内容的速度相当快(但时间足够长,导致 drawInRect: 太慢!),另一层则缓慢地绘制内容。

更快的 CATiledLayer 没有 Zoom 具有默认的 LOD 设置,具有较大的图块尺寸。

较慢的 CATiledLayer 是可缩放的。

仅使用 CATiledLayers 之一即可按预期运行。

问题是将两个层都添加到可见屏幕会导致其中一个或另一个运行缓慢。令人烦恼的是,它似乎使正常绘制的内容变得更快、更慢。

我还没有找到一种方法来可靠地知道一个 CATiledLayer 何时完成绘制。

我认为解决方案是将平铺层排队,因此当较快的平铺层完成时绘制较慢的平铺层。但 CATiledLayer 的文档非常糟糕。

我尝试使用 NSTimer,并在绘制第二个平铺层之前将其设置为 3 秒等待。但这似乎并不能解决问题!我迷路了!

This issue has been encountered by someone else, but I've not seen any solutions - see ( http://openradar.appspot.com/6941930 ).

I have a UIScrollView whose content view's layer contains two CATiledLayers. One tiled layer draws content quite fast (but long enough to make drawInRect: too slow!), the other draws them slowly.

The quicker CATiledLayer doesn't Zoom has has default LOD settings, with a large tile size.

The slower CATiledLayer is zoomable.

Using just one of the CATiledLayers behaves as expected.

The problem is adding both layers to the visible screen causes one or the other to behave slowly. Annoyingly, it seems to make the content that draws normally fast, much slower.

I've not seen a way yet to reliably know when one CATiledLayer has completed its draw.

I think the solution would be to queue the Tiled Layers, so draw the slower tiled layer when the quicker one has finished. But the documentation on CATiledLayer is pretty bad.

I've tried to use a NSTimer, and set it for a 3 second wait before drawing the 2nd Tiled Layer. This however does not seem to solve the problem! I'm lost!

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

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

发布评论

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

评论(1

一抹苦笑 2024-11-04 16:28:01

CATiledLayer 似乎更喜欢屏幕中心附近的任何图块。也许你的某一层更接近边缘?

CATiledLayer seems to favor any tiles near the center of the screen. Perhaps one of your layer's is closer to an edge?

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