【发布时间】:2015-09-09 21:59:01
【问题描述】:
在 UITableViewController 中,我有一个方法可以更新显示总价的底部工具栏。
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = (CartCell)tableView.DequeueReusableCell(CellIdentifier, indexPath);
if (cell == null)
{
cell = new CartCell(this.Handle);
}
cell.UpdateCartCell(tableItems[indexPath.Row]);
return cell;
}
在 UITableViewCell 我有一个 UIStepper。我不知道如何在 UITableViewController 中调用方法,当步进器被按下时,我将能够更新我的底部工具栏文本。
partial class CartCell : UITableViewCell
{
int quantity;
float cartItemTotal;
public CartCell(IntPtr handle)
: base(handle)
{
}
public void UpdateCartCell(CartItem cartItem)
{
quantity = cartItem.Quantity;
cartItemTotal = cartItem.thisTotal;
productName.Text = cartItem.Name;
productDescription.Text = cartItem.Description;
productQuantyty.Text = quantity.ToString();
productPrice.Text = cartItem.Price;
stepper.Value = quantity;
stepper.MinimumValue = 1;
stepper.ValueChanged += (o, s) =>
{
double value = stepper.Value;
#region **** QTY Remove****
if (value < quantity)
{ ... }
#endregion
#region **** QTY Add****
if (value > quantity)
{ ... }
#endregion
};
}
}
【问题讨论】:
标签: ios uitableview xamarin xamarin.ios custom-cell