I'm trying to catch a coordinate from touch event. I can catch but when give zoom have big numbers and when I put this in a function
newCoord = [mapView convertPoint:location toCoordinateFromView:mapView],
I get wrong coordinates. What can I do?
My code:
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView:touch.view];
NSLog(@"locationTOUCH:%f,%f", location.x,location.y);
CLLocationCoordinate2D newCoord;
newCoord = [mapView convertPoint:location toCoordinateFromView:mapView];
NSLog(@"coordinate-%f,%f", newCoord.latitude,newCoord.longitude);
I'd guess it should be fixed by changing
CGPoint location = [touch locationInView:touch.view];
to
CGPoint location = [touch locationInView:mapView];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With