【问题标题】:animated circle on map with iOS 7iOS 7 地图上的动画圆圈
【发布时间】:2013-09-18 12:12:50
【问题描述】:

我正在使用 YHAnimatedCircleView (http://yickhong-ios.blogspot.it/2012/04/animated-circle-on-mkmapview.html) 在地图上显示动画圆圈。它适用于 iOS6,而我在使用 iOS7 时遇到了一些问题。

圆圈在地图上出现了很长一段时间后,它返回给我以下错误:

CoreAnimation: warning, deleted thread with uncommitted CATransaction;

0   QuartzCore                          0x00fcfa96 _ZN2CA11Transaction4pushEv + 374
1   QuartzCore                          0x00fcfe72 _ZN2CA11Transaction15ensure_implicitEv + 316
2   QuartzCore                          0x0106791b _ZN2CA5Layer12begin_changeEPNS_11TransactionEjRP11objc_object + 37
3   QuartzCore                          0x0106914e _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 290
4   QuartzCore                          0x010692a9 -[CALayer setPosition:] + 68
5   QuartzCore                          0x010699af -[CALayer setFrame:] + 799
6   UIKit                               0x0126329c -[UIView(Geometry) setFrame:] + 302
7   UIKit                               0x01361d50 -[UIImageView _setViewGeometry:forMetric:] + 210
8   UIKit                               0x01361fae -[UIImageView setFrame:] + 63
9   SampleApp                              0x0001d331 -[YHAnimatedCircleView drawMapRect:zoomScale:inContext:] + 1329
10  MapKit                              0x00c1b8ff __43-[MKOverlayView overlay:drawKey:inContext:]_block_invoke + 847
11  MapKit                              0x00c1b572 -[MKOverlayView overlay:drawKey:inContext:] + 268
12  VectorKit                           0x0bff941d -[VKRasterOverlay drawKey:inContext:] + 61
13  VectorKit                           0x0bff75e5 __40-[VKRasterOverlayTileSource _queueDraw:]_block_invoke + 485
14  libdispatch.dylib                   0x0647d818 _dispatch_call_block_and_release + 15
15  libdispatch.dylib                   0x064924b0 _dispatch_client_callout + 14

【问题讨论】:

    标签: ios7 mkoverlay mkmapview catransaction


    【解决方案1】:

    我不知道你的框架在做什么,但是图层的绘制不应该在主线程中完成。因此,就像在 this 线程中讨论和解决的那样,您应该只使用 async-dispatcher。

    dispatch_async(dispatch_get_main_queue(), ^{
            [_mapView addOverlay:circle];
        });
    

    【讨论】:

    • 我已经尝试采用您的解决方案,但它并没有改变任何东西,我收到与上面相同的错误“CoreAnimation:警告,删除了未提交 CATransaction 的线程”。
    • 好的。也许您没有发送代码的所有相关部分。另请参阅this thread
    • 谢谢,没办法。我试图在主队列上调度所有覆盖图,但没有得到任何结果。
    【解决方案2】:

    这里是一个为 iOS7 更新 YickHong 解决方案的示例。

    https://github.com/jhurray/iOS7AnimatedMapOverlay

    在 iOS7 中,您不能再将子视图添加到 MKOverlay。在这里查看代码,如果您有任何问题,请联系我 jeff@energ.io。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多