IOS: UIDatePicker does not work well with black background

When I create a new UIDatePicker with its mode set to CountDownTimer, it does not work well with the black background. Does anyone have an understanding? enter image description here

A typical selector is as follows:

enter image description here

CODE: Please note that UIButton is a full-screen button behind the collector to reject the view.

intervalPicker = new UIDatePicker(new RectangleF(0, this.tvc.View.Bounds.Height - 135, this.tvc.View.Bounds.Width, 200));
intervalPicker.Mode = UIDatePickerMode.CountDownTimer;
intervalPicker.CountDownDuration = DeviceSession.CurrentBehavioralEvent.Duration*60;

intervalPicker.ValueChanged += new EventHandler(intervalPicker_EditingChanged);
UIButton b = UIButton.FromType(UIButtonType.Custom);
b.Opaque = false;
b.BackgroundColor = UIColor.Clear;
b.Frame = new RectangleF(0, 0, this.tvc.View.Bounds.Width, this.tvc.View.Bounds.Height);
b.TouchUpInside += (o, s) => {
    intervalPicker.RemoveFromSuperview();
        b.RemoveFromSuperview();
    };

this.tvc.NavigationController.View.AddSubview(b);
this.tvc.NavigationController.View.AddSubview(intervalPicker);
+5
source share
1 answer

UIDatePicker mode in CountDownTimer mode is displayed this way when you set the frame height to less than 216. Other modes do not have this problem.

In your example, the height is set to 200.

Change the height to 216.

+6
source

All Articles