how to create a variable radius in map view - ios

I have a map view and I want to add a variable radius like in the find friends app, allowing the user to drag to make the radius smaller or bigger. How do I do this? Is there any prebuilt functionality that allows you to do this easily?

MKCircle is the class you are looking for. It conforms to the MKAnnotation protocol, so you can just use it like any other annotation. Use the MKCircleView class for the actual drawing of the circle (also check the available sample code).

It can be possible by just using a custom MKAnnotationView that shows a circle? That will maintain size as you zoom around.

Related

How to keep an MKAnnotation View Image fixed on the center of the map as the user pans and moves the map around (Swift)?

using target 8.0 MapKit, I would like to define an MKAnnotation (such as a pin, or a custom one) that remains fixed on the center of the map view as the user moves the map around. Once the user stops moving the map, I would like to be able to read the new coordinates of the annotation. How can I do this? This in swift, thank you soo much
You can follow this link to accomplish this task.They are doing something very similar to your requirement. Its quite descriptive. Link

How does Apple add rating stars to callouts on map views?

Trying to do something that shouldn't be this difficult. Trying to display stars for a rating very similar to a screenshot (below) that Apple provides in the Maps Programming Guide for iOS.
Basically in the subtitle of the Annotation callout, I want to show some stars in a different color than the rest of the text in the subtitle.
I really cannot figure out how to do this without going through the entire nonsense of creating an entirely custom callout. They provide some documentation on doing that, but I am trying to avoid it unless I really have to.
As far as I can tell, with the out of the box MKAnnotation protocol, both title and subtitle properties are just NSString...if I could use an attributed string I could make it work, but it doesn't seem possible. Is Apple "cheating" here by creating a custom callout that looks just like the "normal" one?
Will I really need to go through the process of creating an entire custom callout just to do this? I really want to keep all the existing functionality and layout of the native callout.
Thanks!
Nevering having used this library, I defer to the documentation which mentions:
To provide custom callout views, override the leftCalloutAccessoryView method and use it to return the views.
Although it's under the Subclassing heading for the class documentation, I don't think that means to subclass the entire MKAnnotationView.
The class has a leftCalloutAccessoryView property which is not listed as readonly and has a default value of nil, so presumably you'll need to at least create a custom view, and then set the MKAnnotationView.leftCalloutAccessory to it.
The MKAnnotation protocol seems to just provide limited information to be used by the MKAnnotationView

MapKit overlays to add floor plans to map

I am trying to add an overlay to iOS MapKit in order to show floor plans. However, I am unsure about the best way of doing this. If I add the floor plans by using an MKOverlay, will the floor plans be loaded lazily or do I need to find out which part of the map is being displayed and update overlays thereafter? I also looked at using MKTileOverlay, as it is using lazy loading, but I have the impression that it should be used for completely covering of the map and not only to add to the existing one. Is this correct?
Yes, you are right MKTileOverlay can cover whole map with tiles and Yes it is using lazy loading.
Use MKOverlay if you are not willing to replace native look and fill of map. You can also achieve lazy loading for MKOverlay too.
Note: MKTileOverlay will not remove your already existing MKAnnotations and MKOverlay.
MKOverlay is a protocol, not a class. You want MKTileOverlay as of iOS 7. Things are lazy loaded according to what portion of the map is currently shown.
You might find this useful as a reference on how the tiles are numbered and organized:
https://www.mapbox.com/foundations/how-web-maps-work/
As for covering Apple's map, this will happen by default, but you can also adjust the MKOverlayLevel used to place it between Apple's base map and labels layer, or you can use canReplaceMapContent = YES if you want to disable Apple's maps entirely.

Possible to Draw Custom Routes on MKMapKit ? (iOS)

I know that it is possible to add annotations to an iOS Map.
Is it possible to draw a custom path (such as a path cutting through a park) on my MKMapView and then create a route on the MKMapView using that custom path?
Add MKCircle overlay
In viewForOverlay: create a bezierPath (CG or UI) and add it to the path property of a standard MKOverlayPathView instance
go through this to understand in detail
http://spitzkoff.com/craig/?p=65
hope it helps. happy coding :)

Use custom map image in UIMapView

I wanna accomplish the following, i wanna display a static map image that i have on UIMapView to use the benefits of the zooming and annotation, i've search very hard and i came up with these solution.
There is a library called route-me that give you the ability to customize the map, change the color of the map, specify a predefined road and building, highlight them, but it didn't help me in my issue.
I've looked on apple example that using the MKOverLay class, HazardMap, KMLViewer but they are not showing how to use an image to replace it with the map.
All i want is to display a map image that i have for a place and use it in UIMapView. can anyone put me in the right direction.
Thx in advance.
I replied to this question in this other post. Maybe it helps you:
How do I create an image overlay and add to MKMapView?

Resources