1

viewWillAppeartouchBegin 在方法执行后只被调用一次。

我添加了 UITouch 和UISwipe recognizer,启用了用户交互并启用了所有手势,但GMSMapView只响应一次。

self.mapView_ = [GMSMapView mapWithFrame:CGRectMake(0, 0, 320, 206) camera:nil];
[self.mapView_ setUserInteractionEnabled:YES];
[self.mapView_.settings setAllGesturesEnabled:YES];    

[self.view addSubview: mapView_];

[self.view sendSubviewToBack:self.mapView_]; // I have to do this because 
self.mapView_.myLocationEnabled = YES;


mapView_.delegate = self;

UIGestureRecognizer *uiGestureRecognizer = [[UIGestureRecognizer alloc]init];
uiGestureRecognizer.delegate = self;

UISwipeGestureRecognizer * gestureRecognizer = [[UISwipeGestureRecognizer alloc]init];
gestureRecognizer.direction = UISwipeGestureRecognizerDirectionUp & UISwipeGestureRecognizerDirectionRight & UISwipeGestureRecognizerDirectionLeft & UISwipeGestureRecognizerDirectionDown;
[gestureRecognizer addTarget:self action:@selector(selecterMethod)];

self.mapView_.gestureRecognizers = [NSArray arrayWithObjects:uiGestureRecognizer,gestureRecognizer, nil];
4

0 回答 0