2

我有一个带有 MKMapView 的 UIViewController 和 mapView 顶部的另一个视图(比如说 PaintView)。

当用户用捏合手势触摸 PaintView 时,下面的 mapview 应该响应(以及 paintView 自身)。当用户使用平移手势触摸 Paintview 时,mapview 不得响应。(平移手势用于绘画)。

是否有可能将捏合手势转发到 mapView?

[self.view addSubview:self.mapView];
[self.view addSubview:self.paintView];


UIPanGestureRecognizer* panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
[self.paintView addGestureRecognizer:panRecognizer];
panRecognizer.delegate=self;

UIPinchGestureRecognizer* pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinch:)];
[self.paintView addGestureRecognizer:pinchGesture];
pinchGesture.delegate=self;


-(void)pan:(UIPanGestureRecognizer *)gesture
{
    //do sth in the paintView
}


-(void)pinch:(UIPinchGestureRecognizer *)gesture
{
    //forward pinch gesture to mapview
    //do sth in paintview
}
4

0 回答 0