点击触摸缩放mapView

时间:2011-07-28 05:20:46

标签: iphone ios ios4 mapkit

我正试图抓住触摸事件的坐标。我可以抓住,但是当给变焦有大数字时,我把它放在一个函数

newCoord = [mapView convertPoint:location toCoordinateFromView:mapView],

我的坐标错了。我该怎么办?

我的代码:

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); 

1 个答案:

答案 0 :(得分:1)

我猜它应该通过改变

来解决
CGPoint location = [touch locationInView:touch.view];

CGPoint location = [touch locationInView:mapView];