title: How to make clickable UIButton over UIImageView?
body: <p><strong>I want to create a UIButton to display over an UIImageView</strong>. My code snippet is as shown below:</p>
  
  <pre><code>imageView = [[UIImageView alloc] initWithImage:image]; //initWithImage:image
  
  imageView.userInteractionEnabled = YES; //to enable touch interaction with image
  
  
  
  UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
  [btn setTitle:@"ClickMe" forState:UIControlStateNormal];
  [btn.titleLabel setFont:[UIFont systemFontOfSize:16]];
  
  
   btn.frame = CGRectMake(340, 550, 70, 50);
  
  [btn addTarget:self action:@selector(onClickHotSpotButton)   forControlEvents:UIControlEventTouchUpInside]; //it wasnt working
  
  
  [imageView addSubview:btn];
  [self addSubview:imageView]; 
  </code></pre>
  
  <p>My application displays button exactly on part of image where i want to but it doesn't responds to click image. Instead it does detect single tap as i log output on its detection. But i want this button to get clicked on selection and to perform some function. </p>
  
  <p>Thanks in advance. </p>
  
  <p>wahib</p>