I would like to add an infoWindow when the user taps their current location (blue dot) in the Google Maps API V1.3 for iOS.
I can get infoWindows on other markers but not to display above the users location. Any help would be appreciated. Thanks!
As an alternative option, could you add a marker with a transparent icon at the user's current location?
You could use KVO to move the marker whenever the map view's myLocation value changes.
You can see some sample code for how to add an observer here (but instead of moving the camera, you could move your invisible marker):
when you go with the the 'default' user location, you can't. Because it isn't a real marker, the callbacks aren't fired.
What I did in our case is that I set showsMyLocation=NO
but I rolled my own location. I added another marker and used a CLLocationManager
to position it according to THAT position..
So in pseudocode
- viewDidLoad
map.showsUserLocation=NO;
locationManager = [CLLocationManager new];
locationManager.delegate = self;
}
- locationManager:didUpdateUserLocation:newLoc {
if(!annotation) {
annotation = [GMSMarker new];
annotation.map = map;
}
annotation.position = newLoc;
}
=> own annotation that you can treat like any other marker!