I’m changing my app by migrating iOS maps to google maps using Google Maps SDK for iOS V1.1.0 and I’m trying to animate the markers while adding/removing but I didn’t find any suggestions in the documentation related to this, Please suggest me how to perform the animations on GMSMarkers
In the GMSMarker Class Reference, it says, for the appearAnimation property:
Controls the animation used when this marker is placed on a GMSMapView (default kGMSMarkerAnimationNone, no animation).
Using the Google Maps SDK for iOS, a marker can be made like this:
GMSMarker *startMarker = [GMSMarker markerWithPosition:#"NYC"];
startMarker.appearAnimation = kGMSMarkerAnimationPop;
startMarker.title = #"Start";
startMarker.snippet = #"My address";
startMarker.map = mapView;
Related
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.
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))];
I am using google map SDK 1.9.1. And i have to display blue arrow at direction which ever direction i am facing. but In new SDK i am not find any property to enable it. In old SDK it display that arrow but in new SDK it don't display that arrow
#pragma mark
#pragma mark - setup the google map
-(void) setupMap
{
GMSMapView *mapView = [[GMSMapView alloc] init];
mapView.delegate = self;
[mapView setMyLocationEnabled:YES];
[mapView.settings setCompassButton:YES];
[mapView.settings setMyLocationButton:YES];
[[self getGoogleMapView] addSubview:mapView];
}
Edited
hi after some research i found that direction is not display in ipod only but if you used google map in iphone it display direction arrow.
The reason being that was a part of sensor parameter in the Direction API which is now Deprecated in all Google Maps Display.
Read the official Google Documentation. Scroll Down to the bottom of page and you will see that.
Trying to disable rotation and tilt on my map view but keep zoom and scrolling.. I have tried the following code but the zoom enabled and scroll enabled cause a error as it says the property is not part of the map view.
self.mapView.userInteractionEnabled = NO;
self.mapView.zoomEnabled = YES;
self.mapView.scrollEnabled = YES;
Thanks,
Curtis
I had a few replies to this but managed to solve it myself. There is such a thing called GMSUI Settings which you need to call using the following code..
self.mapView.settings.rotateGestures = NO;
self.mapView.settings.tiltGestures = NO;
Hope this solved things for others
Xcode 14.2
Swift 5.7
whatever your map-view name is would be what you start with. In my case I named it mapView.
mapView.settings.rotateGestures = false
mapView.settings.tiltGestures = false
Unless you specifically need google maps over Apple maps I would recommend using MKMapView
https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKMapView_Class/MKMapView/MKMapView.html
The following properties are defined
zoomEnabled
scrollEnabled
pitchEnabled
rotateEnabled
pitch would be the tilt you were looking for.
I've been using Google Maps SDK for iOS v1.1 without any problems, but just updated to v1.2 (and v1.2.1, released today). Now, when I create a GMSMarker, it can't be tapped to open the info window. The same also happens in the demo application bundled with the SDK, so I'm sure it's not just me.
I'm using the following code:
GMSMarker* marker = [GMSMarker markerWithPosition:CLLocationCoordinate2DMake(result.lat, result.lng)];
marker.title = result.shortName;
marker.tappable = YES;
marker.animated = YES;
marker.map = self.mapView;
I don't see what I could be doing wrong - it seems like a major issue with the updated SDK.
I've implemented all of the delegate methods on GMSMapViewDelegate, and I get nothing called when the marker is tapped.
Can anyone from Google Maps team help? Thanks.
Edit: I've done some further testing, and I believe that this is dependent on the orientation of the device!
Open SDK test application, 'Marker event' demo with device in portrait mode > Markers are tappable.
Open SDK test application, 'Marker event' demo with device in upside-down portrait mode > Markers are not tappable.
This issue has been fixed since version 1.2.2