简体   繁体   中英

info window doesn't pop up when clicking gmsmarker

I am not really sure what is going on at all - this just started happening. When I click on the marker on the map, and info window used to pop up with the title for the marker. I added the delegate method to detect when the marker is being clicked:

- (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker*)marker { NSLog(@"Description: %@", [marker description]); return YES; }

The output of the log is:

Description: <GMSMarker: 0x170150750> xxxxxusernamexxxxx (42.246932, -71.175118), <UIImage: 0x170486ea0> size {40, 53.5} orientation 0 scale 2.000000

The info window isn't popping up. It is being registered that I am tapping the marker, but I don't really know why it doesn't continue to open the infowindow how it used to. I'm guessing it has something to do with the data associated with the marker.

For starters - when I click the info window, the app goes to my backend and retrieves a picture. I see above, <UIImage: 0x170486ea0> size {40, 53.5} orientation 0 scale 2.000000 - should an image be associated with the marker before it has been retrieved? The code to retrieve it doesn't run until I click the info window that should be popping up...so it seems premature that it is there.

Does anyone know of any reason this could be happening? Thanks.

You need to return NO, not YES. Counter-intuitive I know, its not a "continue" its looking for.

From the docs:

YES if this delegate handled the tap event, which prevents the map from performing its default selection behavior, and NO if the map should continue with its default selection behavior.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM