private void Show() { // The moveable cell containing the // datepicker will start hidden. _datePicker = null; ShowTitle(); TableView.ReloadData(); }
private void ToggleDatePicker(NSIndexPath target) { var shouldAttach = true; var targetBeforeOffset = target; TableView.BeginUpdates(); // Do we already have a date picker being // displayed? If so, we need to get rid of it. if (null != _datePicker) { // We do have a date picker displayed! If it's attached // to another cell we'll detach it first, but we must // remember to re-attach ("move") it to the new target. // Otherwise we'll simply turn it off. shouldAttach = false == _datePicker.IsAttachedTo(target); // We'll soon detach the date picker from the table, // which can cause our current target path pointing // to somewhere else after committing the changes. // So we'll "convert" it to its original value, as // if the date picker didn't exist. targetBeforeOffset = _datePicker.IndexPathBeforeOffset(target); _datePicker.Detach(); _datePicker = null; } if (shouldAttach) { var datePickerCell = CellTemplate.ConstructDatePickerCell(TableView); var targetField = GetField(targetBeforeOffset); _datePicker = DetailDatePickerCell.Attachment.Attach(TableView, targetBeforeOffset, targetField, datePickerCell); } TableView.EndUpdates(); }