【问题标题】:IOS: UIDatePicker renders poorly with a black backgroundIOS:UIDatePicker 在黑色背景下渲染效果不佳
【发布时间】:2011-06-18 07:32:39
【问题描述】:

当我创建一个新的 UIDatePicker 并将其 Mode 设置为 CountDownTimer 时,它在黑色背景下呈现不佳。任何人有任何见解?

普通选择器如下所示:

代码:注意 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);

【问题讨论】:

  • 上面的代码我已经贴出来了。

标签: ipad ios rendering xamarin.ios uidatepicker


【解决方案1】:

CountDownTimer模式下的UIDatePicker在设置帧高小于216时会这样显示。其他模式没有这个问题。

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

将高度更改为 216。

【讨论】:

  • 谢谢。此错误在 iOS7 中已修复,但在 iOS6 中仍然可用
  • 很抱歉添加了我的评论,但这只是节省了我一天的工作时间!谢谢。
猜你喜欢
  • 2013-01-19
  • 2012-04-19
  • 1970-01-01
  • 1970-01-01
  • 2014-12-06
  • 2014-01-04
  • 1970-01-01
  • 1970-01-01
  • 2016-12-26
相关资源
最近更新 更多