更改 MKOverlayView 的 MKOverlay 坐标
我在地图上有一个叠加层,我想更改其坐标。为了无缝地做到这一点,我将调用 setNeedsDisplayInMapRect: 方法。
我已经通过更改 fillColor 进行了测试,效果很好:
overlayView.fillColor = [[UIColor greenColor] colorWithAlphaComponent:0.3];
[overlayView setNeedsDisplayInMapRect:mapView.visibleMapRect];
但是,我似乎遇到了砖墙,试图更改我的覆盖视图的中心坐标(这是一个 MKCircleView 带有 MKCircle)。有一个方法在 MKAnnotation ,MKCircle 符合,称为 设置坐标: -这似乎是我所需要的。但不幸的是,MKCircleView 中的circle 属性是只读的。此外, MKOverlayView 也是只读的。
实际上是否有一种方法可以更改覆盖层的坐标,而无需删除覆盖层视图并添加新的覆盖层视图(这会导致屏幕上出现非常明显的闪烁。)?
I have an overlay on the map, and I would like to change its coordinates. To do this seamlessly I'm going to call the setNeedsDisplayInMapRect: method after the change has been made to the view.
I've tested this out by just changing the fillColor and it works fine:
overlayView.fillColor = [[UIColor greenColor] colorWithAlphaComponent:0.3];
[overlayView setNeedsDisplayInMapRect:mapView.visibleMapRect];
However I've seemingly hit a brick wall trying to also change the center coordinates of my overlay view (which is an MKCircleView with an MKCircle). There is a method in
MKAnnotation, which MKCircle conforms to, called setCoordinate: - which seems like what I need. Unfortunately though, the circle
property in MKCircleView is readonly. Moreover the overlay
property in MKOverlayView is also readonly.
Is there actually a way of changing the coordinates for an overlay, without resort to remove the overlay view and adding a new one (which would cause very noticeable flicker on the screen.) ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里发生了同样的问题,所以我正在创建一组方法并根据要求调用它。
same problem is occurred here , so i'm creating set of method and calling it according to requirement.