protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (disposing)
            {
                _defaultTextColor = null;

                if (_picker != null)
                {
                    _picker.RemoveFromSuperview();
                    _picker.ValueChanged -= OnValueChanged;
                    _picker.Dispose();
                    _picker = null;
                }

                if (Control != null)
                {
                    Control.EditingDidBegin -= OnStarted;
                    Control.EditingDidEnd   -= OnEnded;
                }
            }

            base.Dispose(disposing);
        }
Beispiel #2
0
        private void SlideDown(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            this.DateValue = datePicker.Date;
            tableView.ReloadRows(new NSIndexPath[] { path }, UITableViewRowAnimation.None);
            RectangleF screenRect = dvc.View.Window.Frame;
            RectangleF endFrame   = new RectangleF(datePicker.Frame.X, datePicker.Frame.Y + screenRect.Size.Height,
                                                   datePicker.Frame.Size.Width, datePicker.Frame.Size.Height);

            //endFrame.origin.y = screenRect.Y + screenRect.Size.Height;

            // start the slide down animation
            UIView.BeginAnimations(null);
            UIView.SetAnimationDuration(0.3);

            // we need to perform some post operations after the animation is complete
            UIView.SetAnimationDelegate(dvc);
            //UIView.SetAnimationDidStopSelector(slideDownDidStop());

            datePicker.Frame = endFrame;
            UIView.CommitAnimations();

            // remove the "Done" button in the nav bar
            dvc.NavigationItem.RightBarButtonItem = rightOld;
            dvc.NavigationItem.LeftBarButtonItem  = leftOld;

            // deselect the current table row
            tableView.DeselectRow(path, true);
            datePicker.RemoveFromSuperview();
            datePicker = null;
            if (DoneEditing != null)
            {
                DoneEditing();
            }
        }
Beispiel #3
0
 protected override void DisposeView(NoCaretField nativeView)
 {
     if (_picker != null)
     {
         _picker.RemoveFromSuperview();
         _picker.ValueChanged -= HandleValueChanged;
         _picker.Dispose();
         _picker = null;
     }
 }
Beispiel #4
0
        void  SetTimePicker()
        {
            UIDatePicker picker = new UIDatePicker
            {
                Mode = UIDatePickerMode.DateAndTime
            };

            picker.SetDate(NSDate.Now, true);
            picker.AddTarget(this, new Selector("DateChange:"), UIControlEvent.ValueChanged);
            Control.InputView = picker;
            UIToolbar       toolbar = (UIToolbar)Control.InputAccessoryView;
            UIBarButtonItem done    = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (object sender, EventArgs click) =>
            {
                Control.Text = SelectedValue;
                toolbar.RemoveFromSuperview();
                picker.RemoveFromSuperview();
                Control.ResignFirstResponder();
                MessagingCenter.Send <Object, string>(this, "pickerSelected", SelectedValue);
            });
            UIBarButtonItem empty = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null);

            toolbar.Items = new UIBarButtonItem[] { empty, done };
        }