在我的应用程序中我在我的视图中添加了Google地图。
I want to know the touch point on the mapView / myView,
我在哪里录音
所以我按如下方式实现了逻辑。
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint touchPoint = [[touches anyObject] locationInView:mapView_];
CGPoint touchPoint2 = [[touches anyObject] locationInView:self.view];
NSLog(@"========== %@", NSStringFromCGPoint(touchPoint));
NSLog(@"========== %@", NSStringFromCGPoint(touchPoint2));
//UITouch *touch = [[event allTouches] anyObject];
//CGPoint touchPoint = [touch locationInView:touch.view];
}
但仅适用于第一次触摸,从此方法未调用的下一个触摸事件开始。
我没有得到问题是什么
答案 0 :(得分:0)
你无法在地图上获得触摸位置,当我们触摸它时,它变为缩放,触摸事件在UIView上
答案 1 :(得分:0)
借助于此,我每次在mapview上触摸精确的触摸点时都会得到一个日志
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint touchPoint = [[touches anyObject] locationInView:self.viewMap];
NSLog(@"==========1 %@", NSStringFromCGPoint(touchPoint));
}