I have a timer:
[NSTimer scheduledTimerWithTimeInterval:(float)jpegInterval/1000 target:self selector:@selector(jpegDownloaderSelector:) userInfo:url repeats:YES];
jpegDownloaderSelector perform the fetching of image from url and set it at imageView as below:
-(void) jpegDownloaderSelector:(NSTimer*)timer{
[self performSelectorInBackground:@selector(jpegDownloader:) withObject:(NSString*)[timer userInfo]];
}
-(void) jpegDownloader:(NSString*)imageUrl{
dispatch_async(dispatch_get_main_queue(), ^{
imgData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://10.8.9.100:509/jpeg"]];
imageView.image = [UIImage imageWithData:imgData];
});
}
I have also set imageView with gestureRecognizer
[imageView addGestureRecognizer:singleTapRecognizer];
[imageView addGestureRecognizer:doubleTapRecognizer];
where the recognizer definitions are:
singleTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(functoCall:)];
singleTapRecognizer.numberOfTapsRequired = 1;
singleTapRecognizer.numberOfTouchesRequired = 1;
doubleTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(funcToCall2:)];
doubleTapRecognizer.numberOfTapsRequired = 2;
doubleTapRecognizer.numberOfTouchesRequired = 1;
The problem i have is, when timer starts, and i double tap imageView, double tap recognizer does not response, instead single tap responded.
If i set NO for timer repeats parameter, double tap responded. Thus, i suspect double tap is not responding due to running of background functions that is called by timer.
Anyone has suggestion that i can implement the background function and no problem with recognizing double tap.