3

I want to implement a circular selection (with center and radius) on the MKMapView like it looks on the screenshot below. Should be possible to move the selection pulling the green pointer and change circle radius pulling the dark gray pointer.

What the best way to implement it? Maybe there's already some solution?

I would be grateful for any help.

enter image description here

Code cracker
  • 3,105
  • 6
  • 37
  • 67
d0ping
  • 462
  • 4
  • 16
  • 1
    Use GMSCircle..Refer http://stackoverflow.com/questions/15380441/how-to-display-a-circle-in-gmsmapview – Vidhyanand Mar 18 '15 at 07:23
  • GMSCircle just draw a circle on the Earth's surface. The MapKit has the same class MKCircleView for drawing round objects on the map. But this is not enough. This element should be more interactive. – d0ping Mar 18 '15 at 07:58
  • The same element have the Reminder app on the your iPhone. You can see this by creating reminder by place. – d0ping Mar 18 '15 at 08:04
  • I think a custom UIView above the MKMapView (not a subview of it) will work better than trying to make a dynamically resizable MKCircle. The custom UIView can use regular CG and gesture recognizers. It might explain the "X" icon at the top-right which probably disables this "custom resizable circle UIView" so user can interact with the actual map. Use the methods MKMapView/MapKit provides to convert to/from CG units to MK coordinates/points. It's possible someone has already created a ready-made component. –  Mar 18 '15 at 11:04

2 Answers2

2

I have not found ready-made solution for select circular map region from MKMapView. So I created own component to do that. https://github.com/d0ping/DBMapSelectorViewController

d0ping
  • 462
  • 4
  • 16
0

You can add a UISlider to your map and update MKCircle radius on the Value Changed action.

Please take a look how to use MKCircle here - How to create MKCircle in Swift?

IvanPavliuk
  • 1,460
  • 1
  • 21
  • 16