Inheritance: UITableViewCell
		public override UITableViewCell GetCell (UITableView tv)
		{
			EntryElementCell cell = (EntryElementCell)tv.DequeueReusableCell(EntryElementCell.KEY);
			if (cell == null){
				cell = new EntryElementCell();
			} 
			
			cell.Update(this, tv);
				
			return cell;
		}
        public override UITableViewCell GetCell(UITableView tv)
        {
            Value = FormatDate(DateValue);
            EntryElementCell cell = (EntryElementCell)tv.DequeueReusableCell("DateTimeElement");

            if (cell == null)
            {
                cell = new EntryElementCell("DateTimeElement");
            }

            cell.Update(this, tv);
            var picker = CreatePicker();

            picker.ValueChanged += (sender, e) => {
                this.DateValue            = picker.Date;
                cell.DetailTextLabel.Text = FormatDate(picker.Date);
                this.Value = FormatDate(picker.Date);
                cell.SetNeedsLayout();
            };
            cell.TextField.EditingDidBegin += (sender, e) => {
                this.DateValue            = picker.Date;
                cell.DetailTextLabel.Text = FormatDate(picker.Date);
                this.Value = FormatDate(picker.Date);
                cell.SetNeedsLayout();
            };

            cell.TextField.InputView = picker;
            cell.TextField.Alpha     = 0;
            cell.TextLabel.TextColor = Appearance.LabelTextColor;

            cell.TextLabel.HighlightedTextColor = Appearance.LabelHighlightedTextColor;
            cell.TextLabel.Font = Appearance.LabelFont;

            cell.DetailTextLabel.Text                 = FormatDate(this.DateValue);
            cell.DetailTextLabel.TextColor            = Appearance.DetailLabelTextColor;
            cell.DetailTextLabel.Font                 = Appearance.DetailLabelFont;
            cell.DetailTextLabel.HighlightedTextColor = Appearance.DetailLabelHighlightedTextColor;


            cell.BackgroundColor = Appearance.BackgroundColorEditable;

            var toolbar = new UIToolbar();

            toolbar.Items = new UIBarButtonItem[] {
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (e, a) => {
                    cell.TextField.ResignFirstResponder();
                })
            };
            toolbar.SizeToFit();
            cell.TextField.InputAccessoryView = toolbar;
            return(cell);
        }
Beispiel #3
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            EntryElementCell cell = (EntryElementCell)tv.DequeueReusableCell(EntryElementCell.KEY);

            if (cell == null)
            {
                cell = new EntryElementCell();
            }

            cell.Update(this, tv);


            return(cell);
        }
		public override UITableViewCell GetCell (UITableView tv)
		{
			Value = FormatDate (DateValue);
			EntryElementCell cell = (EntryElementCell)tv.DequeueReusableCell("DateTimeElement");
			if (cell == null){
				cell = new EntryElementCell("DateTimeElement");
			} 

			cell.Update(this, tv);
			var picker = CreatePicker();
			picker.ValueChanged += (sender, e) => { 
				this.DateValue = picker.Date;
				cell.DetailTextLabel.Text = FormatDate(picker.Date); 
				this.Value = FormatDate(picker.Date);
				cell.SetNeedsLayout();
			};
			cell.TextField.EditingDidBegin += (sender, e) => {
				this.DateValue = picker.Date;
				cell.DetailTextLabel.Text = FormatDate(picker.Date); 
				this.Value = FormatDate(picker.Date);
				cell.SetNeedsLayout();
			};

			cell.TextField.InputView = picker;
			cell.TextField.Alpha = 0;
			cell.TextLabel.TextColor = Appearance.LabelTextColor;
			
			cell.TextLabel.HighlightedTextColor = Appearance.LabelHighlightedTextColor;
			cell.TextLabel.Font = Appearance.LabelFont;
			
			cell.DetailTextLabel.Text = FormatDate(this.DateValue); 
			cell.DetailTextLabel.TextColor = Appearance.DetailLabelTextColor;
			cell.DetailTextLabel.Font = Appearance.DetailLabelFont;
			cell.DetailTextLabel.HighlightedTextColor = Appearance.DetailLabelHighlightedTextColor;


			cell.BackgroundColor = Appearance.BackgroundColorEditable;

			var toolbar =  new UIToolbar();
			toolbar.Items = new UIBarButtonItem[] {
				new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
				new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (e, a)=>{
					cell.TextField.ResignFirstResponder();
				})
			};
			toolbar.SizeToFit();
			cell.TextField.InputAccessoryView = toolbar;				
			return cell;
		}