UIDatePicker select Month and Year

前端 未结 11 1862
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-27 04:00

I need a UIDatePicker for selecting Month and Year only. I checked the class reference documents. Looks like UIDatePicker is a UIView.

11条回答
  •  离开以前
    2020-11-27 04:27

    You can use the open source library named

    AKMonthYearPickerView

    import AKMonthYearPickerView
    
    AKMonthYearPickerView.sharedInstance.show(vc: viewController, doneHandler: doneHandler, completetionalHandler: completetionalHandler)
    

    https://github.com/ali-cs/AKMonthYearPickerView

    to install it using pods,

    pod 'AKMonthYearPickerView' 
    

    to customize previous years limit and bar color

    AKMonthYearPickerView.sharedInstance.barTintColor =   UIColor.blue
    
    AKMonthYearPickerView.sharedInstance.previousYear = 4
    

提交回复
热议问题