12

Quick and Easy Date Picker

 4 years ago
source link: https://github.com/MattLLLLL/MDatePickerView
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

q6jmYb2.png!web2YFJJnR.gif7FvyUjE.png!webRzYnUnE.png!web

Requirements

  • iOS 9.0
  • Xcode 9
  • Swift 4.0

Installation

You can install MDatePickerView in several ways:

Add source files to your project.

  • Use CocoaPods:
pod 'MDatePickerView'

Usage

import MDatePickerView

Usage example

lazy var MDate : MDatePickerView = {
        let mdate = MDatePickerView()
        mdate.Color = .gray
        mdate.delegate = self
        mdate.from = 1980
        mdate.to = 2100
        return mdate
    }()

Adopt the MDatePickerViewDelegate protocol in your menu view controller, e.g.

extension ViewController : MDatePickerViewDelegate {
    func mdatePickerView(selectDate: Date) {
        let formatter = DateFormatter()
        formatter.dateFormat = "yyyy - MM - dd"
        let date = formatter.string(from: selectDate)
        Label.text = date
    }
}

What's next

  • Any suggestions?

Contribution

  • If you found a bug, open an issue
  • If you have a feature request, open an issue
  • If you want to contribute, submit a pull request
  • If you have any issue or want help, please drop me a mail on [email protected]

License

MDatePickerView is available under the MIT license.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK