I am using a custom gesture recognizer (as given in the link Intercepting/Hijacking iPhone Touch Events for MKMapView) for detecting touch events on MKMapView. gesture recognizer is defined in WildcardGestureRecognizer.h and implemented in WildcardGestureRecognizer.m file. When this gesture recognizer is added to MKMapview, one can read from following method any touch events
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if (touchesBeganCallback)
touchesBeganCallback(touches, event);
NSLog(@"touchesBegan");
}
Based on this touch detection I want to call method tapMethod from MainViewController(Containing MKMapView).
-(void) tapMethod
{
dontUpdateLocation =1;// a variable to check stoppoing of location update.
NSLog(@" map tapped");
}
I tried following
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if (touchesBeganCallback)
touchesBeganCallback(touches, event);
NSLog(@"touchesBegan");
MainViewController *updateController = [[MainViewController alloc]init ];
[updateController tapMethod];
[updateController release];
}
It does print "map tapped" but doesn't change value of variable dontUpdateLocation. How can I do it?