【问题标题】:Limiting the visible dates in UIDatePicker限制 UIDatePicker 中的可见日期
【发布时间】:2013-04-17 22:29:56
【问题描述】:

有没有办法限制 UIDatePicker 中的日期范围?我知道 maximumdate 和 minimumdate 属性,但我想将可见的最小年份限制为 2010 年。我不希望用户能够看到 2010 年之前的任何年份。有什么想法吗?

【问题讨论】:

    标签: objective-c xcode nsdate uipickerview


    【解决方案1】:

    我不相信使用 UIDatePicker 可以做到这一点,但您可以使用自己的 UIPickerView 实现这一点,确保实现 UIPickerViewDelegate 方法 pickerView:didSelectRow:inComponent: 以处理糟糕的日期,例如 2 月 30 日,(到模仿 UIDatePicker 的行为)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-03
      • 1970-01-01
      • 1970-01-01
      • 2012-08-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多