UILongPressGestureRecognizer无法使用Googlemap

时间:2015-05-06 10:28:23

标签: ios objective-c xcode cocoa-touch

This is ma screen

我有一个谷歌地图和一个按钮,我需要为按钮和视图(包含视图)提供UILongPressGestureRecognizer

//Add gesture to Button
    gestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(LongPressedHandler)];
    [Button addGestureRecognizer:gestureRecognizer]

我在Button上使用了上面的代码手势,只有当我包含以下功能时才能正常工作

-(void)deactivate
{
    mapView_.settings.scrollGestures =NO;
    mapView_.settings.zoomGestures = NO;
    mapView_.settings.tiltGestures=NO;
    mapView_.settings.rotateGestures=NO;

}

-(void)activate
{
    mapView_.settings.scrollGestures = YES;
    mapView_.settings.zoomGestures = YES;
    mapView_.settings.tiltGestures=YES;
    mapView_.settings.rotateGestures=YES;
}

还有其他方法可以在mapView和按钮上提供UILongPressGestureRecognizer

...谢谢

1 个答案:

答案 0 :(得分:1)

在谷歌地图中尝试默认的MapVIew LongPress事件

- (void)mapView:(GMSMapView *)mapView
    didLongPressAtCoordinate:(CLLocationCoordinate2D)coordinate;

要获得更多信息,请使用以下链接:http://www.codeitive.com/7mQmqWUkUU/adding-long-press-gesture-recognizer-to-google-map-in-ios.html

我的这个链接可以帮助你