title: Adding events to array of buttons in scrollview
body: <p>I am creating an application which contains a timeslot screen where users are displayed a list of buttons in half an hour slots. I I have timeslots going from 9 - 6.</p>
  
  <p>I created the buttons by creating a for loop like this </p>
  
  <pre><code>    UIButton *csBut = [[UIButton alloc]init];
      csBut = [UIButton buttonWithType:UIButtonTypeCustom];
      csBut.frame = CGRectMake(xPos, yPos, 145, 55);
  
      [csBut setImage:[imageList objectAtIndex:i] forState:UIControlStateNormal];
  
      [SV addSubview:csBut];
  </code></pre>
  
  <p>I set up the image of each button using the imageList array I have created. SV is the scrollview I have set up. Each button is added to this scrollview. The buttons are all displaying perfectly. Now the problem I am having is that when I try and set up the buttons to do something, its not responding to  the button clicks. I have been using</p>
  
  <pre><code>[csBut addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
  </code></pre>
  
  <p>and the method I have created should simply display an alert (just temp till I get this working properly)</p>
  
  <pre><code>-(IBAction)buttonClicked:(id)sender{
  //ConfirmBut.hidden = NO;
  
  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"Testing"
                                                 delegate:self cancelButtonTitle:@"Okay" otherButtonTitles: nil];
  [alert show];
  </code></pre>
  
  <p>}</p>
  
  <p>However, when I click the button, nothing happens. Can anyone tell me what I am doing wrong?</p>
  
  <p>Thanks in advance for any help.</p>