UPDATE 6/2/15
Just staple a UITapGestureRecognizer onto the map and then extract the coordinate from the touch point. Your didTapAtCoordinate and didTapAtOverlay will continue to fire as before.
UITapGestureRecognizer *touchTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapTouchTap:)];
[self.view addGestureRecognizer:touchTap];
-(void)tapTouchTap:(UITapGestureRecognizer*)touchGesture
{
CGPoint point = [touchGesture locationInView:self.view];
CLLocationCoordinate2D coord = [self.mapView.projection coordinateForPoint:point];
NSLog(@"%f %f", coord.latitude, coord.longitude);
}
ORIGINAL POST
You are likely missing two snippets of code.
Adopt the GMSMapViewDelegate in your header file:
@interface Map : UIViewController <GMSMapViewDelegate>
You also need to set the delegate in your viewDidLoad:
self.mapView.delegate = self;
Now this should fire for you:
- (void)mapView:(GMSMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate
{
NSLog(@"You tapped at %f,%f", coordinate.latitude, coordinate.longitude);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…