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.
Related
How does one get a list (array) of currently visible overlay from a MapkitView?
Background - for example I want to show direction arrows to the center of certain Overlay types on my mapkitview, however how do I get the visible ones? There seems to be no way to do this I can see? So do I need to got through all overlays (actually ~8000) and do my own check to see what would be showing on the screen? Seems a waste if MapKit would have already effectively done this as part of deciding what overlays need to be displayed at a given time.
I've been tinkering with some similar problems and the most efficient way I could figure out was to add the overlays as annotations as well, since MKOverlay implements MKAnnotation. Then you would be able to use annotationsInMapRect for the currently displayed mapRect. However this would also return any regular MKAnnotations, and only uses the calculated middle of the overlay. The only way (so far as I figured) to only get the overlays would be to iterate over each overlay and use:
-(BOOL)intersectsMapRect:(MKMapRect)mapRect;
on the currently visible mapRect.
If you found another way I'd be happy to hear!
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
In one of my application I need to move marker on drag and drop, once user drop the pin I need to get the dropped pin location.
This is very basic feature of map but I am surprised that there is no such option in the library.
In native map there is property called "Draggable", is there any equivalent property in the Arcgis ?
With the help of ARCGIS community support, I was able to find the answer for this question.
We have to implement the method mapView:didMoveTapAndHoldAtPoint:mapPoint:features: on AGSMapViewTouchDelegate.
The delegate method gets called every time the user moves his finger while taping and holding the map view. The method also provides the array of features at that location. So in the method you can update the geometry of the features to the new mapPoint.
You can use this sample as a reference. The sample adds a marker if you tap and hold and changes the location of that marker when you move while taping and holding.
I just started using SKMap library on IOS recently.
One behavior of the function didSelectAnnotation (from the SKMapViewDelegate Protocol), is that whenever an annotation got selected, the center of the map's visible region will move to the location of that annotation.
Is there any way that I can disable this?
It's actually not a feature of didSelectAnnotationfunction, but rather of showCalloutForAnnotation function. Just set parameter animated in the function to NO.
Is it possible to animate changes to the coordinates of an annotation on an MKMapView in iOS? Nothing in the API seems to indicate that this is possible, however apps like Uber seem to do this when showing car locations in their map. Perhaps they are calling setCoordinate: multiple times over a short time to give the appearance of animation taking place?