In WatchKit, the documentation for WKInterfaceMap specify that:
"Tapping the map launches the Maps app on the user’s Apple Watch and
displays the corresponding location.
However: I want to show multiple map annotations on the map - is there a way to specify which map annotation will be displayed in Maps.app when the map is tapped?
There is currently no visibility as to exactly what happens when Apple Watch transitions from a WKInterfaceMap to Apple's native Maps application.
Try the WatchKit Developer Forums, exactly the right place for this question!
Currently in WatchOS 2 (at least), tapping on a WKInterfaceMap will open up the Watch's Maps app with the option the get directions to the location that was at the centre point of your WKInterfaceMap. When viewing these directions to this location it will be marked with a Red Pin annotation.
None of your custom annotations will be displayed in the Watch's Maps app.
You can use following methods to add multiple annotations. As per Apple documentation, currently only 5 annotations can be displayed on watch app's map
addAnnotation:withPinColor
addAnnotation:withImageNamed:centerOffset:
addAnnotation:withPinColor:
Here is a sample code, which displays 2 annotations:
CLLocationCoordinate2D mapLocation1 = CLLocationCoordinate2DMake(37.787730, -122.403370);
CLLocationCoordinate2D mapLocation2 = CLLocationCoordinate2DMake(37.794873, -122.397892);
//
MKCoordinateSpan coordinateSpan = MKCoordinateSpanMake(0.1, 0.1);
// Other colors include red and green pins
[self.map addAnnotation:mapLocation1 withPinColor: WKInterfaceMapPinColorPurple];
[self.map addAnnotation:mapLocation2 withPinColor: WKInterfaceMapPinColorRed];
[self.map setRegion:(MKCoordinateRegionMake(mapLocation, coordinateSpan))];
Related
Good afternoon, who once worked with heremap sdk premium for ios. How do I make it possible to click on the NMAMapMarker? What they have written in the documentation does not describe it, but maybe I'm wrong.
there are different option available for NMAMapMarker to use.
This represents a marker used to display an icon on a geographical position on a map. The map handles proper placement of icons on the screen as well as panning and rotation.
+mapMarkerWithGeoCoordinates:
+mapMarkerWithGeoCoordinates:icon:
+mapMarkerWithGeoCoordinates:image:
coordinates
icon
draggable
draggingOffsetEnabled
anchorOffset
-initWithGeoCoordinates:
-initWithGeoCoordinates:icon:
-initWithGeoCoordinates:image:
-setAnchorOffsetUsingLayoutPosition:
-setSize:forZoomLevel:
-setSize:forZoomRange:
-resetIconSize
Check for more details : https://developer.here.com/documentation/ios-premium/3.18/api_reference_jazzy/Classes/NMAMapMarker.html#%2Fc:objc(cs)NMAMapMarker(im)initWithGeoCoordinates.
Please revert with your code implementation in case of any further concern.
What function would be able to hide local landmarks when browsing a confined region via Apple Maps API ?
There is a property called showsPointsOfInterest for MKMapView, you can set it to NO to hide icons and labels for restaurants, schools, and other relevant points of interest.
showsPointsOfInterest is deprecated.
With IOS 13 you have the option to filter: here a example to show no items on the map
mapView.pointOfInterestFilter = .some(MKPointOfInterestFilter(including: []))
Is there one way to customize myLocationButton GoogleMaps ? I want to add my own button with a background image which make the same function as the original Google button
First your Application needs to get current location using CLLocation Manager. If you don't know how, refer to my answer here : For google maps iOS sdk, current location occasionally gets plotted at 0,0
Now for button press action, do this
- (void)locationButtonPressed
{
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:self.mapView.myLocation.coordinate.latitude
longitude:self.mapView.myLocation.coordinate.longitude
zoom:self.mapView.camera.zoom];
[self.gMapView animateToCameraPosition:camera];
}
Hope that helps.
I am developing one application which has functionality like drawing route on map. User needs to start and stop button which indicates that user start drawing route on map with lat long. When user reached his destination and user stop it, I am able to see route from start location to destination location route and I want to share that route with someone through application.
Here is my basic idea of application so any one here please suggest me what to do for that kind of functionality.
As far as I know, direction sharing is already possible when using Google Maps. As given in Get directions and show routes, to send someone directions and a link to the route in Google Maps, follow the steps below:
Open the Google Maps app.
In the bottom right, tap Directions .
Select a route.
In the top right, tap More on three vertical dots.
Tap Share directions.
To help you on the implementation, you can use Maps SDK for iOS - Getting Started and Google Maps URL Scheme for a complete guide on how to work with or to launch Google Maps app for iOS and perform specific functions.
I am doing that thing like this
-(void)drawSenderPath:(CLLocationCoordinate2D)locPolyLine {
[mapView clear]
[pathSender addCoordinate:locPolyLine];
GMSPolyline *polyline = [GMSPolyline polylineWithPath:pathSender];
// Add the polyline to the map.
polyline.strokeColor = AppOrangeColor;
if ([self.homeViewDelegate respondsToSelector:#selector(getPathColor)]) {
polyline.strokeColor = [self.homeViewDelegate getPathColor];
}
polyline.strokeWidth = 3.0f;
polyline.map = mapView;
}
I need to display a map without street names. is it possible using MKMapView ? if not, is there a different map API for iOs that supports this?
thanks,
Nimrod
What you need to do, is to set the maptype to Satellite.
Here's how to do this:
[mapView setMapType:MKMapTypeSatellite];
EDIT:
Not sure if it's satellite, but try one of these:
[mapView setMapType:MKMapTypeStandard];
[mapView setMapType:MKMapTypeHybrid];
[mapView setMapType:MKMapTypeSatellite];
Nimrod, you can't show the map view hiding the street name, only showing the Satellite view. However, check the Google Maps SDK - they just launched it and they provide a lot of thinks that the default MKMapView don't provide.
The MapBox iOS SDK will allow you to customize your map completely, including removing street names, but with MapKit-like functionality.
If you prefer, you can use the Google Maps SDK and make a custom map in this link:
http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html?utm_medium=twitter
And then use the atributes generated in this to custom your map in the app.