add a speacial circle View to MKMapView

I had konw one method to do that , codes like below :


CLLocationCoordinate2D d1 = CLLocationCoordinate2DMake(22.9752041040, 114.4812180328);

_TestCircle = [MKCircle circleWithCenterCoordinate:d1 radius:400];

[self.map addOverlay:_TestCircle];



But I wanna the circle View is fixed in iPhone screen, When you drag the MKMapVew , it will not move

and the most important , When you Pinch the MapView , this circle view will also change its size ,

when zoom in ,it became smaller , when zoom out , it became bigger


Thanks a lot to discuss this question

I would think rather than an overlay you would want just a plain UIView in front of the map view. You would have to add your own pinch gesture recognizer to resize your circle smoothly. I have not done exactly this (I have done it with pan gesture recognizers, but not pinch) so I'm not sure what issues you'd run into when working alongside the map view's built in gesture recognizers. If that approach is unworkable you might end up having to use the regionWillChangeAnimated / regionDidChangeAnimated map view delegate methods, but using your own gesture recognizer would be more responsive I think.

Thx ,But if We add a plain UIVIew (Circle shape) , there is another question , we do not konw , what size of the UVIew when the MKMapVew was pinch

or zoom in \ zoom out

you see , when We addOverlay MKCircle to the MKMapView , its size is auto change when the MKMapView change ?

You could compute the size using the MapKit functions that convert UIKit points to MapKit map points and calculate meters between map points. Or you could determine empirically if there is a linear relationship between the magnitude of the pinch and the change in map zoom level, and just apply the same scaling factor that the map view uses. The latter is a little more risky as it depends on the internal implementation of the map view.

add a speacial circle View to MKMapView
 
 
Q