title: Gesture recognizer and UIImageView
body: <p>I found this code to change the image when it is clicked.</p>
  
  <p>in .h</p>
  
  <pre><code>@interface MyappViewController : UIViewController 
  {
      NSDictionary *ddata;
      UIImageView *firstImage;
  }
  @property(retain,nonatomic) IBOutlet UIImageView *firstImage;
  </code></pre>
  
  <p>in .m</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
      firstImage.userInteractionEnabled = YES;
      UIPinchGestureRecognizer *pgr = [[UIPinchGestureRecognizer alloc] 
                                       initWithTarget:self action:@selector(clickHandler:)];
      pgr.delegate = self;
      [firstImage addGestureRecognizer:pgr];
      [pgr release];
    //  [self clickHandler:self];  
  }
  
  -(void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
      /* destroy the transition view, set the image first */
      UIImageView *transitionImageView = (UIImageView *)context;
      self.firstImage.image = transitionImageView.image;
      [transitionImageView removeFromSuperview];
      transitionImageView = nil;
  }
  
  - (void)clickHandler:(id)sender {
      /* temporary view for the animation */
      NSLog(@"Click Handled ");
  
      UIImageView *transitionImageView = [[UIImageView alloc] initWithFrame:self.firstImage.frame];
      UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[ddata objectForKey:@"pic"]]]];
      transitionImageView.image =  image;
      transitionImageView.alpha = 0.0f;
      [self.view addSubview:transitionImageView];
  
      [UIView beginAnimations:@"UpdateImages" context:transitionImageView];
      [UIView setAnimationDuration:2.0f];    
      transitionImageView.alpha = 1.0f;
      [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];    
      [UIView commitAnimations];
  }
  </code></pre>
  
  <p>When I click the image nothing happens, but if I call [self clickHandler:self]; in ViewDidLoad, the image changes. My problem is that the click is not handled when I click the image.</p>