I have a mapView, in my mapView
you can zoom with double tap, pinch, UIButton
(+ and -) and with an UISlider
.
Now... I want recognize the doubletap and the pinch, to refresh the position of UISlider... I use a NSInteger variable called zoomLevel
to make this.
I have tried two way, but not working:
1)
UIGestureRecognizer *recognizer;
// taps
recognizer = [[ UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap)];
tapGR = (UITapGestureRecognizer *)recognizer;
tapGR.numberOfTapsRequired = 2;
tapGR.cancelsTouchesInView = NO;
[self.view addGestureRecognizer:tapGR];
[recognizer release];
2)
- (void)touchesEnded:(NSSet *)touches withEvent: (UIEvent *) event{
UITouch* touch = [[event allTouches] anyObject];
NSLog(@"2 taps");
if(touch.tapCount == 2 ){
NSLog(@"2 taps");
[self zoomLevelWithMapView:mappa];
}
Can someone help me? Better with pratical example Thank you.