执行viewWillAppear
方法后,只调用一次touchBegin。
我添加了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];