GMSMapView仅捕获第一个触摸事件

时间:2013-09-02 11:22:00

标签: iphone objective-c google-maps

执行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];

0 个答案:

没有答案