Its posible set a custom marker with images loaded by server in mapview iOS swift? I jus found customs marker with local images
By marker, I'm assuming you are referring to and utilizing a MKAnnotationView (which is what Apple's pin views subclass from).
MKAnnotationView has an .image property, which you could set to any UIImage. You'd have to download the image first from server, then assign it to the annotation view.
It doesn't look like there is a way to link the MKAnnotationView's image property directly to a remote URL without defining that behavior for yourself (and perhaps subclassing drawing code).
Related
I'm making an iOS app (using Swift) that has a map in the Mapbox iOS SDK. I've gotten to the point of displaying several markers on the map. Now, I want the user to be able to select a marker from the list, panning to that marker (easy), which also makes the marker's callout bubble appear automatically without the user having to touch it (not so easy).
It's this last task I'm having trouble with. While I've found the RMMarker class's showLabel() method, I can't seem to directly access a RMAnnotation's associated RMMarker object, so I'm not sure where or how to call this method.
Does anyone know how this is done?
Ignore the showLabel() API — this is not the callout in use, but rather a text label that's possible directly on the annotation.
You probably want -[RMMapView selectAnnotation:animated:] with a NO in the animated argument.
I am creating a map with custom image for annotation, I want an image from my map object.
Is it possible?
Assuming you are using WKInterfaceMap it is not possible to get the map image (at least not that I know of). You can create a map image locally in your map extension and then set that image on a WKInterfaceImage or WKInterfaceGroup. I am not sure what would be involved in creating a map image with MapKit. I create map images from tiles for use in my app and set it as the background on a WKInterfaceGroup to create a UI that looks like this Is it possible to position views on top of each other.
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.
So `MKAnnotation's. Fun stuff.
My questions:
What's the difference between an annotation's title and its subtitle and how does that affect the visual component of the annotation?
What's the difference between a MKPinAnnotationView and a MKAnnotationView?
Are there different types of map annotations in iOS apart from pins?
Title is main heading of your pin.
The subtitle is actually displaying the address/(common info) of the dropped pin.You can store other deeply information of related to title that is puted on pin.
MKAnnotation is a protocol you need to adopt if you wish to show your object on a MKMapView. The coordinate property tells MKMapView where to place it. title and subtitle properties are optional but if you wish to show a callout view you are expected to implement title at a minimum.
MKAnnotationView visually presents the MKAnnotation on the MKMapView. The image property can be set to determine what to show for the annotation. However you can subclass it and implement drawRect: yourself.
MKPinAnnotationView is a subclass of MKAnnotationView that uses a Pin graphic as the image property. You can set the pin color and drop animation.
Don't forget about the leftCalloutAccessoryView and the rightCalloutAccessoryView properties of MKAnnotationView that can be used to customize the callout view.
The title and subtitle are displayed when a pin is selected on the map. The subtitle simply falls below the title.
MKPinAnnotationView is simply an specialized form of MKAnnotationView that knows how to draw a pin (and a shadow) and also allows setting the pin color. It's the only built-in annotation view with an image, you have to make your own if you want something different (but it's very easy to do).
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