adit
adit

Reputation: 33644

UIPinchGestureRecognizer not getting called

I am not really sure why the target is not getting called when I do this:

 UIImage * imgSrc = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imageSource]]];
            UIImageView * imgView = [[[UIImageView alloc] initWithImage:imgSrc] retain];

            UIPinchGestureRecognizer * pinchGestureRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(resizeImage:)];
            [imgView addGestureRecognizer:pinchGestureRecognizer]; 
            [pinchGestureRecognizer release];

- (IBAction)resizeImage:(UIPinchGestureRecognizer *)sender
{
   //not getting here
}

the resize image is not getting called. The image is shown just fine

Upvotes: 0

Views: 383

Answers (1)

Ken W
Ken W

Reputation: 999

You need to set the imgView.userInteractionEnabled = YES. It is default to "NO".

Upvotes: 1

Related Questions