IOS:UIDatePicker渲染效果不佳,背景为黑色

时间:2011-01-31 00:35:11

标签: ipad ios rendering xamarin.ios uidatepicker

当我创建一个新的UIDatePicker并将其Mode设置为CountDownTimer时,它使用黑色背景渲染效果不佳。有人有任何见解吗? enter image description here

普通选择器看起来像这样:

enter image description here

代码:请注意,UIButton是选择器后面的全屏按钮,用于关闭视图

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);

1 个答案:

答案 0 :(得分:6)

当您将帧高度设置为小于216时,CountDownTimer模式下的UIDatePicker会以这种方式显示。其他模式没有此问题。

您的示例是将高度设置为200.

将高度更改为216。