title: Cannot trigger IBAction of a UIButton from UIView
body: <p>I'm new to Objective C. I created the method to construct &amp; display a button inside a <code>UIView</code> (<code>UIView</code> is inside another View named contentView, and contentView to be added as a subview in a <code>UIScrollView</code>. Well the problem is that I cannot click on the generated button to trigger the IB action named <code>playAction</code>. Can someone pls help me? Thanks</p>
  
  <pre><code>- (void) displayCategoryBestSellers
  {
      //Structure: ScrollView -&gt; ContentView -&gt; MainView -&gt; ImageView and Button
  
      UIView * mainView = [[UIView alloc] initWithFrame:CGRectMake(0,0,160,105)];
      mainView.userInteractionEnabled = YES;
  
      UIImage * backgroundImage = [UIImage imageNamed:@"blackwhitesquare.png"];           
      UIImageView * uiImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,145,105)];
      uiImageView.image = backgroundImage;
      uiImageView.center = CGPointMake(mainView.frame.size.width /2, mainView.frame.size.height/2);   
      uiImageView.userInteractionEnabled = YES;
  
      [mainView addSubview:uiImageView];
  
      UIButton *playButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
      playButton.frame = CGRectMake(0,0,100,90);
  
      NSData *mydata = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://media.theseus.cataloguesolutions.com/images/72by72/324178611_0004_PG_1.jpg"]];
      UIImage *myimage = [[UIImage alloc] initWithData:mydata];
  
      [playButton setBackgroundImage:myimage forState:UIControlStateNormal];
      playButton.center = CGPointMake(mainView.frame.size.width /2, mainView.frame.size.height/2);        
      [playButton addTarget:self action:@selector(playAction:) forControlEvents:UIControlEventTouchDown];     
      playButton.userInteractionEnabled = YES;
  
      [mainView addSubview:playButton];
  
      [contentView addSubview:mainView];
  
      contentView.userInteractionEnabled = YES;
  
      [scrollView addSubview:contentView];
      scrollView.delegate = self;
  
      scrollView.userInteractionEnabled = YES;        
  }
  
  -(IBAction)playAction: (id)sender
  {
      NSLog(@"Button Clicked");
  }
  </code></pre>