Multiple lines in RMAnnotation title in Mapbox? - ios

Im wondering if its possible to make the annotation title that comes up when you tap an annotation have multiple lines. Mapbox uses the SMCalloutView for that popup view.
The Mapbox references are very poor for ios...

You can fork SMCallOutView an create your own custom version after you can Use it like this question.
How to change margins in SMCalloutView

Related

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.

How to add Annotation pin for source and destination in iOS using two color?

I am developing a small project, which will display the source and distance trace route, I did complete till that, now the thing is I am unable to add two annotation pin of different color for source and destination, suppose I am using red for source and green for destination.
This might be huge help for everybody who are learning and working.
Thanks
You could use images for your pins or you could use a subclass of MKAnnotationView - MKPinAnnotationView and just change the pinColor property, it's documentation can be found here:
http://developer.apple.com/library/ios/#DOCUMENTATION/MapKit/Reference/MKPinAnnotationView_Class/Reference/Reference.html#//apple_ref/occ/cl/MKPinAnnotationView

MKAnnotationView - Callout title or description with multiple lines?

Is it possible to display several lines in title or description/subtitle without writing your own custom annotation view, using i.e. MKPinAnnotationView?
I believe it's not possible.
What you need is to create a custom callout, and layout it the way you want. You can even mimic the native appearance.
This page can help you creating the custom callout: http://blog.asolutions.com/2010/09/building-custom-map-annotation-callouts-part-1/

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