1
我需要開發像這樣的附加image.i日曆搜索很多libraries.but沒有人是類似於這個自定義選擇view.please有人幫助我。謝謝。 。多個日期範圍選擇與自定義視圖在swift 3
我需要開發像這樣的附加image.i日曆搜索很多libraries.but沒有人是類似於這個自定義選擇view.please有人幫助我。謝謝。 。多個日期範圍選擇與自定義視圖在swift 3
我想你使用這個庫:Koyomi
在編程
選擇日期您可以選擇特定的日期。
let today = Date()
var components = DateComponents()
components.day = 7
let weekLaterDay = Calendar.current.date(byAdding: components, toDate: today)
koyomi.select(date: today, to: weekLaterDay)
// If want to select only one day.
koyomi.select(date: today)
// If want to select multiple day.
let dates: [Date] = [date1, date2, date3]
koyomi.select(dates: dates)
您也可以取消選擇可用。
koyomi.unselect(today, to: weekLaterDay)
// If want to unselect only one day.
koyomi.unselect(today)
// If want to unselect multiple day.
let dates: [Date] = [date1, date2, date3]
koyomi.unselect(dates: dates)
// unselect all date
koyomi.unselectAll()
// You can also call this delegate.
extension ViewController: KoyomiDelegate {
func koyomi(_ koyomi: Koyomi, didSelect date: Date?, forItemAt indexPath: IndexPath) {
print("You Selected: \(date)")
}
func koyomi(_ koyomi: Koyomi, currentDateString dateString: String) {
currentDateLabel.text = dateString
}
@objc(koyomi:shouldSelectDates:to:withPeriodLength:)
func koyomi(_ koyomi: Koyomi, shouldSelectDates date: Date?, to toDate: Date?, withPeriodLength length: Int) -> Bool {
if length > invalidPeriodLength {
print("More than \(invalidPeriodLength) days are invalid period.")
return false
}
return true
}
}
它適合我。你可以試試這個庫。
我試過了,但我需要選擇像附圖 –
@SathishKumar你可以檢查我更新的答案。 –
謝謝@Ravi Dhorajiya ..我會試試這個 –