views:

54

answers:

1
+1  Q: 

iPhone UIGestures

Hi,

I used

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
[self.view addGestureRecognizer:singleTap];
- (void)handleSingleTap:(UIGestureRecognizer *)gestureRecognizer {
    UIView* view = gestureRecognizer.view;
    CGPoint loc = [gestureRecognizer locationInView:view];
}

But this gave me an error at CGPoint loc = [gestureRecognizer locationInView:view]; Why???

A: 

try using:

CGPoint loc = [gestureRecognizer locationInView:self.view];

or alternatively rename the UIView *view.. like so:

UIView* gesturevView = gestureRecognizer.view; 
CGPoint loc = [gestureRecognizer locationInView:gesturevView];
Larsaronen
i used this also But same error is given.I created an universal application on ipad i used UIGesture class perfectly but on iphone its give me error
a111