Iphone UITouch事件只调用/工作一次。不是第二次工作,
在我的应用程序中,我在视图中添加了一个谷歌地图。Iphone UITouch事件只调用/工作一次。不是第二次工作,,iphone,objective-c,uitouch,gmsmapview,Iphone,Objective C,Uitouch,Gmsmapview,在我的应用程序中,我在视图中添加了一个谷歌地图。 我想知道mapView/myView上的接触点,我在哪里录制的 所以我实现了如下逻辑 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { CGPoint touchPoint = [[touches anyObject] locationInView:mapView_]; CGPoint touchPoint2 = [[touches anyOb
我想知道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];
}
但是它仅适用于第一次触摸,从下一次触摸事件开始,此方法不调用
我不知道问题是什么,你无法在地图上找到触摸位置,当我们触摸它时,它会变为缩放,触摸事件会显示在UIView上。借助于此,我每次触摸mapview时都会得到一个带有精确触摸点的日志
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint touchPoint = [[touches anyObject] locationInView:self.viewMap];
NSLog(@"==========1 %@", NSStringFromCGPoint(touchPoint));
}
我只尝试过这段代码,但令人惊讶的是,每次我在任何点触摸inside view时,它都会调用它,并完美地记录值是的,它对所有其他视图都非常有效。。但是,不是在我目前的观点,即谷歌地图视图谁告诉你,我们不能在地图上触摸事件?只有当我们点击地图时,地图才会缩放。