Problem in Multiple button onclick event in iPhone
<p>I have created five buttons in a for loop dynamically. Now I want to associate an OnClick event with every button which do different actions. How I can do this and how can I detect which button is clicked?</p>

<pre><code>for (NSUInteger i=0;i&lt;5;i++)
{
    UIButton *myButton1 = [[UIButton buttonWithType:UIButtonTypeCustom] 
        initWithFrame:CGRectMake(5, 57,15, 15)];
    [myButton1 setTitle:@"Click Me!" forState:UIControlStateNormal];
    [myButton1 addTarget:self action:@selector(buttonClicked1:) 
        forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:myButton1];
}
</code></pre>
