WWCalendarTimeSelector 1.3.13

WWCalendarTimeSelector 1.3.13

测试已测试
Lang语言 SwiftSwift
许可证 MIT
Released 上次发布2016 年 9 月
SPM支持 SPM

Weilson Tan 维护。



  • Weilson Wonder

试用由 Appetize 提供的演示 (!

屏幕截图

WWCalendarTimeSelector WWCalendarTimeSelector WWCalendarTimeSelector WWCalendarTimeSelector WWCalendarTimeSelector WWCalendarTimeSelector

描述

一个具有 Android 主题的日期时间选择器。使用这个高度可定制的选择器选择日期和时间。 WWCalendarTimeSelector 是一个组件,可以帮助用户直观地选择日期或日期。

特性

  • 简单使用
  • 单日期选择
  • 多日期选择
  • 范围日期选择
  • 支持竖屏和横屏方向
  • 字体、颜色、大小定制
  • 多日期选择的 3 种分组样式(简单、药丸、链球)
  • 无限日期选择
  • 简单的日期选择限制(通过协议)

安装

WWCalendarTimeSelector 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod 'WWCalendarTimeSelector'

使用

WWCalendarTimeSelector 的使用非常简单。它具有易于使用和简单的协议,您可以通过几行代码开始使用!

// 1. You must instantiate with the class function instantiate()
let selector = WWCalendarTimeSelector.instantiate()

// 2. You can then set delegate, and any customization options
selector.delegate = self
selector.optionTopPanelTitle = "Awesome Calendar!"

// 3. Then you simply present it from your view controller when necessary!
self.presentViewController(selector, animated: true, completion: nil)

以下是它看起来是如何的示例!

import WWCalendarTimeSelector

class YourViewController: UIViewController, WWCalendarTimeSelectorProtocol {
    func showCalendar() {
        let selector = WWCalendarTimeSelector.instantiate()
        selector.delegate = self
        /*
          Any other options are to be set before presenting selector!
        */
        presentViewController(selector, animated: true, completion: nil)
    }

    func WWCalendarTimeSelectorDone(selector: WWCalendarTimeSelector, date: NSDate) {
        print(date)
    }
}

选项

当然,每个人都希望有一个具有他们自己主题颜色和字体的选择器!因此,以下是您可以定制的选项!请先设置选项,然后再展示选择器!选择器呈现之后设置的任何选项都可能导致不可预期的行为。

协议

@objc public protocol WWCalendarTimeSelectorProtocol {
    optional public func WWCalendarTimeSelectorDone(selector: WWCalendarTimeSelector, dates: [NSDate])
    optional public func WWCalendarTimeSelectorDone(selector: WWCalendarTimeSelector, date: NSDate)
    optional public func WWCalendarTimeSelectorCancel(selector: WWCalendarTimeSelector, dates: [NSDate])
    optional public func WWCalendarTimeSelectorCancel(selector: WWCalendarTimeSelector, date: NSDate)
    optional public func WWCalendarTimeSelectorWillDismiss(selector: WWCalendarTimeSelector)
    optional public func WWCalendarTimeSelectorDidDismiss(selector: WWCalendarTimeSelector)
    optional public func WWCalendarTimeSelectorShouldSelectDate(selector: WWCalendarTimeSelector, date: NSDate) -> Bool
}

枚举

@objc public enum WWCalendarTimeSelectorSelection : Int {
    case Single
    case Multiple
    case Range
}

@objc public enum WWCalendarTimeSelectorMultipleSelectionGrouping : Int {
    case Simple
    case Pill
    case LinkedBalls
}

@objc public enum WWCalendarTimeSelectorTimeStep : Int {
    case OneMinute
    case FiveMinutes
    case TenMinutes
    case FifteenMinutes
    case ThirtyMinutes
    case SixtyMinutes
}

辅助类

@objc public final class WWCalendarTimeSelectorStyle : NSObject {
    private(set) public var showDateMonth: Bool
    private(set) public var showMonth: Bool
    private(set) public var showYear: Bool
    private(set) public var showTime: Bool
    public func showDateMonth(show: Bool)
    public func showMonth(show: Bool)
    public func showYear(show: Bool)
    public func showTime(show: Bool)
}

@objc public class WWCalendarTimeSelectorDateRange : NSObject {
    private(set) public var start: NSDate
    private(set) public var end: NSDate
    public var array: [NSDate] { get }
    public func setStartDate(date: NSDate)
    public func setEndDate(date: NSDate)
}

以下是可用的选项

delegate: WWCalendarTimeSelectorProtocol?
optionIdentifier: AnyObject?
optionStyles: WWCalendarTimeSelectorStyle
optionTimeStep: WWCalendarTimeSelectorTimeStep
optionShowTopContainer: Bool
optionShowTopPanel: Bool
optionTopPanelTitle: String?
optionSelectionType: WWCalendarTimeSelectorSelection
optionCurrentDate: NSDate
optionCurrentDates: Set<NSDate>
optionCurrentDateRange: WWCalendarTimeSelectorDateRange
optionStyleBlurEffect: UIBlurEffectStyle
optionMultipleSelectionGrouping: WWCalendarTimeSelectorMultipleSelectionGrouping
optionCalendarFontMonth: UIFont
optionCalendarFontDays: UIFont
optionCalendarFontToday: UIFont
optionCalendarFontTodayHighlight: UIFont
optionCalendarFontPastDates: UIFont
optionCalendarFontPastDatesHighlight: UIFont
optionCalendarFontFutureDates: UIFont
optionCalendarFontFutureDatesHighlight: UIFont
optionCalendarFontColorMonth: UIColor
optionCalendarFontColorDays: UIColor
optionCalendarFontColorToday: UIColor
optionCalendarFontColorTodayHighlight: UIColor
optionCalendarBackgroundColorTodayHighlight: UIColor
optionCalendarBackgroundColorTodayFlash: UIColor
optionCalendarFontColorPastDates: UIColor
optionCalendarFontColorPastDatesHighlight: UIColor
optionCalendarBackgroundColorPastDatesHighlight: UIColor
optionCalendarBackgroundColorPastDatesFlash: UIColor
optionCalendarFontColorFutureDates: UIColor
optionCalendarFontColorFutureDatesHighlight: UIColor
optionCalendarBackgroundColorFutureDatesHighlight: UIColor
optionCalendarBackgroundColorFutureDatesFlash: UIColor
optionCalendarFontCurrentYear: UIFont
optionCalendarFontCurrentYearHighlight: UIFont
optionCalendarFontColorCurrentYear: UIColor
optionCalendarFontColorCurrentYearHighlight: UIColor
optionCalendarFontPastYears: UIFont
optionCalendarFontPastYearsHighlight: UIFont
optionCalendarFontColorPastYears: UIColor
optionCalendarFontColorPastYearsHighlight: UIColor
optionCalendarFontFutureYears: UIFont
optionCalendarFontFutureYearsHighlight: UIFont
optionCalendarFontColorFutureYears: UIColor
optionCalendarFontColorFutureYearsHighlight: UIColor
optionClockFontAMPM: UIFont
optionClockFontAMPMHighlight: UIFont
optionClockFontColorAMPM: UIColor
optionClockFontColorAMPMHighlight: UIColor
optionClockBackgroundColorAMPMHighlight: UIColor
optionClockFontHour: UIFont
optionClockFontHourHighlight: UIFont
optionClockFontColorHour: UIColor
optionClockFontColorHourHighlight: UIColor
optionClockBackgroundColorHourHighlight: UIColor
optionClockBackgroundColorHourHighlightNeedle: UIColor
optionClockFontMinute: UIFont
optionClockFontMinuteHighlight: UIFont
optionClockFontColorMinute: UIColor
optionClockFontColorMinuteHighlight: UIColor
optionClockBackgroundColorMinuteHighlight: UIColor
optionClockBackgroundColorMinuteHighlightNeedle: UIColor
optionClockBackgroundColorFace: UIColor
optionClockBackgroundColorCenter: UIColor
optionButtonTitleDone: String
optionButtonTitleCancel: String
optionButtonFontCancel: UIFont
optionButtonFontDone: UIFont
optionButtonFontColorCancel: UIColor
optionButtonFontColorDone: UIColor
optionButtonFontColorCancelHighlight: UIColor
optionButtonFontColorDoneHighlight: UIColor
optionButtonBackgroundColorCancel: UIColor
optionButtonBackgroundColorDone: UIColor
optionTopPanelBackgroundColor: UIColor
optionTopPanelFont: UIFont
optionTopPanelFontColor: UIColor
optionSelectorPanelFontMonth: UIFont
optionSelectorPanelFontDate: UIFont
optionSelectorPanelFontYear: UIFont
optionSelectorPanelFontTime: UIFont
optionSelectorPanelFontMultipleSelection: UIFont
optionSelectorPanelFontMultipleSelectionHighlight: UIFont
optionSelectorPanelFontColorMonth: UIColor
optionSelectorPanelFontColorMonthHighlight: UIColor
optionSelectorPanelFontColorDate: UIColor
optionSelectorPanelFontColorDateHighlight: UIColor
optionSelectorPanelFontColorYear: UIColor
optionSelectorPanelFontColorYearHighlight: UIColor
optionSelectorPanelFontColorTime: UIColor
optionSelectorPanelFontColorTimeHighlight: UIColor
optionSelectorPanelFontColorMultipleSelection: UIColor
optionSelectorPanelFontColorMultipleSelectionHighlight: UIColor
optionSelectorPanelBackgroundColor: UIColor
optionMainPanelBackgroundColor: UIColor
optionBottomPanelBackgroundColor: UIColor
optionSelectorPanelOffsetHighlightMonth: CGFloat
optionSelectorPanelOffsetHighlightDate: CGFloat
optionSelectorPanelScaleMonth: CGFloat
optionSelectorPanelScaleDate: CGFloat
optionSelectorPanelScaleYear: CGFloat
optionSelectorPanelScaleTime: CGFloat
optionLayoutTopPanelHeight: CGFloat
optionLayoutHeight: CGFloat?
optionLayoutWidth: CGFloat?
optionLayoutHeightRatio: CGFloat
optionLayoutWidthRatio: CGFloat
optionLayoutPortraitRatio: CGFloat
optionLayoutLandscapeRatio: CGFloat

作者

Weilson Wonder

许可证

WWCalendarTimeSelector 采用 MIT 许可协议。有关更多信息,请参阅 LICENSE 文件。