Note that there are some explanatory texts on larger screens.

plurals
  1. POChange coordinate of MKOverlay for an MKOverlayView
    text
    copied!<p>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 <a href="http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKOverlayView_class/Reference/Reference.html#//apple_ref/occ/cl/MKOverlayView">setNeedsDisplayInMapRect:</a> method after the change has been made to the view.</p> <p>I've tested this out by just changing the fillColor and it works fine:</p> <pre><code>overlayView.fillColor = [[UIColor greenColor] colorWithAlphaComponent:0.3]; [overlayView setNeedsDisplayInMapRect:mapView.visibleMapRect]; </code></pre> <p>However I've seemingly hit a brick wall trying to also change the center coordinates of my overlay view (which is an <a href="http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKCircleView_class/Reference/Reference.html">MKCircleView</a> with an <a href="http://developer.apple.com/library/IOs/#documentation/MapKit/Reference/MKCircle_class/Reference/Reference.html">MKCircle</a>). There is a method in <a href="http://developer.apple.com/library/IOs/#documentation/MapKit/Reference/MKAnnotation_Protocol/Reference/Reference.html#//apple_ref/occ/intf/MKAnnotation">MKAnnotation</a>, which MKCircle conforms to, called <a href="http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKAnnotation_Protocol/Reference/Reference.html#//apple_ref/occ/intf/MKAnnotation">setCoordinate:</a> - which seems like what I need. Unfortunately though, the <code>circle</code> property in MKCircleView is readonly. Moreover the <code>overlay</code> property in <a href="http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKOverlayView_class/Reference/Reference.html#//apple_ref/occ/cl/MKOverlayView">MKOverlayView</a> is also readonly.</p> <p>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.) ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload