Пример #1
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var cell        = tableView.DequeueReusableCell("SummaryCell") ?? new SummaryItemsTableViewCell("SummaryCell");
            var summaryItem = summaryItems [indexPath.Row];

            cell.TextLabel.Text       = summaryItem.Label;
            cell.DetailTextLabel.Text = CurrencyFormatter.StringFromNumber(summaryItem.Amount);
            // Only show a line above the last cell
            if (indexPath.Row != summaryItems.Length - 2)
            {
                cell.SeparatorInset = new UIEdgeInsets(0.0f, 0.0f, 0.0f, cell.Bounds.Size.Width);
            }

            return(cell);
        }
Пример #2
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            UITableViewCell cell = null;

            switch ((UITableViewSections)indexPath.Section)
            {
            case UITableViewSections.SummaryItems:
                cell = tableView.DequeueReusableCell("SummaryCell") ?? new SummaryItemsTableViewCell("SummaryCell");
                var summaryItem = summaryItems [indexPath.Row];
                cell.TextLabel.Text       = summaryItem.Label;
                cell.DetailTextLabel.Text = CurrencyFormatter.StringFromNumber(summaryItem.Amount);
                cell.SelectionStyle       = UITableViewCellSelectionStyle.None;
                // Only show a line above the last cell
                if (indexPath.Row != summaryItems.Length - 2)
                {
                    cell.SeparatorInset = new UIEdgeInsets(0.0f, 0.0f, 0.0f, cell.Bounds.Size.Width);
                }
                break;

            case UITableViewSections.DiscountGiftCard:
                cell = tableView.DequeueReusableCell("Cell", indexPath);
                cell.SeparatorInset = UIEdgeInsets.Zero;
                switch ((UITableViewDiscountGiftCardSection)indexPath.Row)
                {
                case UITableViewDiscountGiftCardSection.Discount:
                    cell.TextLabel.Text = "Add Discount";
                    break;

                case UITableViewDiscountGiftCardSection.GiftCard:
                    cell.TextLabel.Text = "Apply Gift Card";
                    break;
                }
                cell.TextLabel.TextAlignment = UITextAlignment.Center;
                break;

            case UITableViewSections.Continue:
                cell = tableView.DequeueReusableCell("Cell", indexPath);
                cell.TextLabel.Text          = "Continue";
                cell.TextLabel.TextAlignment = UITextAlignment.Center;
                break;
            }

            cell.PreservesSuperviewLayoutMargins = false;
            cell.LayoutMargins = UIEdgeInsets.Zero;

            return(cell);
        }