Using DollarPGestureRecognizer in webView iOS

| | August 6, 2015

I am trying to use DollarPGestureRecognizer to webView in iOS. I’ve followed the process to recognize it on webView both programmatically and using storyboard, but its throwing exception on GestureView.h file’s drawRect method

- (void)drawRect:(CGRect)rect {
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetLineWidth(context, 5.0);
    CGContextSetLineCap(context, kCGLineCapRound);
    NSLog(@"I'm just here, got me!!");

    for (int i = 0; i < [completeStrokes count]; i++) {
        Stroke *stroke = [completeStrokes objectAtIndex:i];
        NSLog(@"Welcome to the freakshow");
        [self drawStroke:stroke inContext:context];
    }

    for (NSValue *touchValue in currentTouches) {
        Stroke *stroke = [currentTouches objectForKey:touchValue];
        [self drawStroke:stroke inContext:context];
    }
}

its not entering the first loop and throwing

Thread1_EXC_BAD_ACCESS (Code1).

To enable gesture on webView I also implemented UIWebViewDelegate method

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer

I am not getting the actual problem.

Leave a Reply