MKCircle overlay inverted - ios

I've found this post how to draw circle overlay around location
Draw a circle of 1000m radius around users location in MKMapView
I'm able to set some color, or transparency or whatever for overlay.
but I'd like to do the same for rest of the map area.
F.e outside circle overlay sort of "terra incognita"
One possible solution in my mind is:
get circle coordinates, radius
create UIView overlay above mapView with shadow and blur radius respectively to mapView circle
simply saying I'd like to have something like this:
Any ideas how to achieve this?

I think you're thinking right. Howbeit, for make a blur background u need make screenshot and calculate blur with library GPUImage for example.

Related

MapKit MKCircle Change Radius on Zoom Level

I'm trying to create an MKCircle overlay on a map, however I would like the size of the circle on the screen to remain constant as the user zooms.
So as the user zooms in, the radius gets smaller and as the user zooms out, the radius gets larger.
I'm working in Swift 3. Is there a specific MapKit method I should be using to accomplish this? I know there is an option to use an image of a circle as an annotation, however I want to dynamically change the color of the circle.
In other words, I want the MKCircle to scale the same way an MKPolyline scales as you zoom in and out
So as the user zooms in, the radius gets smaller and as the user zooms out, the radius gets larger
An MKCircle would presumably be part of an overlay (MKOverlay). An overlay works by simulating drawing on the earth itself. Thus, the drawing changes with the zoom level.
So if you don't want that to happen, don't use an MKOverlay. You could, for example, just make a normal view that displays a circle and lay it in front of the map view. Or you could use an annotation instead (MKAnnotation); an annotation's image does not change size as the map is zoomed.

How to let the user define a region?

I'd like to let the user define a region on a map. The region will be represented by a circle defined by a center and its radius.
Here is a picture of the result I'd like to have :
radius: I want the radius to be define with a small circle that the user will drag to set the radius size (and I'd like to be able to draw a dashed line between the center and the circle as well as showing the distance).
center I want to set the center of the map by letting the user drag the map behind to move the red pin to the desired new center.
I know how to get the blue circle, how to add a gesture to get the new radius and to redraw a circle at run time. What I don't know is how to draw dashed line, small black circle and display / update text inside the MKMapView.
Also, I'm completely lost when it's about setting the center. How can I drag the map around by letting all this object (blue circle, red pin center, dashed line, ...) not moving ?
Should I completely forget about MKMapView and draw everything above it in a UIView and then get coordinate by mapping fake touch on MKMapView ?

Round selection of location on the MKMapView

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.
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
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?

Removing specific area from blurred space MKMapView

Is there any chance to remove blur on a specified area to achieve something like below? Assume that I have blurred MKMapView and want to remove circle shaped blurred area from MKMapView. Any other opinions to achieve something like this would be appreciated.

How to rotate triangle image of speech bubble on the surface of bubble?

How to rotate triangle image of speech bubble on the surface of bubble ? triangle image can scale and rotate with the touches and dragging.
What you can do is clip the triangle part of the bubble form the original image, make it into a UIImageView and place it just as if it is a part of the bubble. Then use this UIImageView and make it scale , rotate etc likewise according to UIGestures or UITouch whichever is easier for you along with the bubble. If you want any code help for that please ask. Thanks :)

Resources