UITapGestureRecognizer touchesEnded, , GMSMapView.
UITapGestureRecognizer mapView:
self.touchTap = [[TouchGestureRecognizer alloc] initWithTarget:self action:@selector(tapTouchTap)];
self.touchTap.mapView = self.mapView;
[self.view addGestureRecognizer:self.touchTap];
TouchDownGestureRecognizer.h:
#import <UIKit/UIKit.h>
@interface TouchGestureRecognizer : UITapGestureRecognizer
@property GMSMapView *mapView;
@end
TouchDownGestureRecognizer.m:
#import "TouchGestureRecognizer.h"
#import <UIKit/UIGestureRecognizerSubclass.h>
@implementation TouchGestureRecognizer
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
UITouch *touch = touches.allObjects[0];
CGPoint point = [touch locationInView:self.mapView];
CLLocationCoordinate2D coord = [self.mapView.projection coordinateForPoint:point];
NSLog(@"%f %f", coord.latitude, coord.longitude);
}
@end