I have a custom UITableViewCell which has an UIButton in it. When the button is clicked the click event is getting called multiple times. Here is the code what i am using.
CustomCell.cs
public static CustomCell Create ()
{
return ( CustomCell ) Nib.Instantiate ( null , null ) [0];
}
internal void BindData()
{
//some code
btnSave.TouchUpInside+= (object sender, EventArgs e) =>
{
Console.WriteLine("button clicked");
};
}
TableSource.cs
public override UITableViewCell GetCell (UITableView tableView,NSIndexPath indexPath)
{
CustomCell cell = tableView.DequeueReusableCell ( CustomCell.Key ) as CustomCell ?? CustomCell.Create ();
cell.BindData ();
return cell;
}
Any idea why is this happening? am i reusing the cells properly?
Thank you.