RockBaby
RockBaby

Reputation: 381

UIImageView not responding to UIPanGestureRecognizer gesture

I've got 2 views. The idea is to select image from second view and place it on first view. The problem is I tried to add pan gesture, it's not responding or calling the method. Please help. Thanks

Code in my First view

- (void)newStampImage: (UIImage *)inImage
{
    stampImageView = [[UIImageView alloc]initWithImage:inImage];
    UIPanGestureRecognizer *stampPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(moveStamp:)];
    [stampPanGesture setMinimumNumberOfTouches:1];
    [stampPanGesture setMaximumNumberOfTouches:1];
    [stampImageView addGestureRecognizer:stampPanGesture];
    stampImageView.center = self.view.center;
    [self.view addSubview:stampImageView];
}

Upvotes: 2

Views: 2067

Answers (2)

user1240409
user1240409

Reputation: 75

Please make sure you have done setting for recognizing gesture,i mean set gesturerecognization property to yes,then it might work.

Thanks

Upvotes: 0

Saurabh Passolia
Saurabh Passolia

Reputation: 8109

please add

stampImageView.userInteractionEnabled = YES;

Upvotes: 12

Related Questions