HI! I need to create buttons foreach element of my list, when I click on any button show a new view with different data. This is my code, but only works the last button created. Button 1 and 2, dont works, why??? Thanks :D
for(int i=0; i<=2; i++)
{
UIButton button = new UIButton();
button = UIButton.FromType(UIButtonType.RoundedRect);
button.Frame = new RectangleF(100f, 100f + g, 100f, 100f);
button.Tag = i;
button.SetTitle(lista[i].numero_credito, UIControlState.Normal);
View.AddSubview(button);
button.TouchUpInside += (sender, e) => {
if (this.detalle == null) {
this.detalle = new Details ();
}
Details x = new Details ();
this.NavigationController.PushViewController (detalle, true);
x.infodetail(username, fecha, lista[i].numero_credito.ToString());
};
g = g+20;
}