GMSMapView阻止UIScrollView滚动

Wil*_*Hua 6 ios google-maps-sdk-ios swift

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

mapView.settings.tiltGestures = false
mapView.settings.scrollGestures = false
mapView.settings.rotateGestures = false
Run Code Online (Sandbox Code Playgroud)

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

Ale*_*ase 8

在swift 3.0中

mapView.settings.setAllGesturesEnabled(false)
Run Code Online (Sandbox Code Playgroud)


Yar*_*aro 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
}
}
Run Code Online (Sandbox Code Playgroud)