GMSMapView阻止UIScrollView滚动

时间:2015-10-10 20:31:57

标签: ios swift google-maps-sdk-ios

我有一个嵌套在UIScrollView中的GMSMapView。我已经关闭了GMSMapView的滚动功能

mapView.settings.tiltGestures = false
mapView.settings.scrollGestures = false
mapView.settings.rotateGestures = false

但是,每当我尝试滚动视图时意图UIScrollView将滚动,没有任何反应。我该怎么做才能解决这个问题?

2 个答案:

答案 0 :(得分:6)

在swift 3.0中

mapView.settings.setAllGesturesEnabled(false)

答案 1 :(得分:0)

在UIScrollView中检测触摸手势(触摸 - >检测触摸了哪个视图,然后启用/禁用UIScroll视图的滚动。

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 
    CGPoint locationPoint = [[touches anyObject] locationInView:self.view];
CGPoint viewPoint = [myImage convertPoint:locationPoint fromView:self.view];
if ([mapView pointInside:viewPoint withEvent:event]) {
   disable scrolling
}
}