Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

negative or zero item sizes are not supported in the flow layout #128

Open
429329513wanting opened this issue Jun 10, 2020 · 1 comment
Open

Comments

@429329513wanting
Copy link

xcode:11.5
swift:5

    self.calendarView = CalendarView()
    self.calendarView?.frame = CGRect(x: 0, y: HT_StatusBarAndNavigationBarHeight, width: KScreenWidth, height: 200)
    calendarView?.dataSource = self
    calendarView?.delegate =  self
    calendarView?.marksWeekends = true
    calendarView?.direction = .horizontal
    calendarView?.setDisplayDate(Date())
    view.addSubview(self.calendarView!)
@429329513wanting
Copy link
Author

//MARK: - calendarDelegate
func startDate() -> Date {

    var dateComponents = DateComponents()
    dateComponents.month = -1
    
    let today = Date()
    
    let threeMonthsAgo = self.calendarView?.calendar.date(byAdding: dateComponents, to: today)!
    
    return threeMonthsAgo!
}
func endDate() -> Date {

  var dateComponents = DateComponents()

  dateComponents.month = 12
  let today = Date()
  
  let twoYearsFromNow = self.calendarView?.calendar.date(byAdding: dateComponents, to: today)!
  
    return twoYearsFromNow!
}

func calendar(_ calendar: CalendarView, didScrollToMonth date: Date) {
    
}

func calendar(_ calendar: CalendarView, didDeselectDate date: Date) {
    
}


func headerString(_ date: Date) -> String? {
    
    return "标题"
}

func calendar(_ calendar: CalendarView, didSelectDate date: Date, withEvents events: [CalendarEvent]) {
    
}

func calendar(_ calendar: CalendarView, canSelectDate date: Date) -> Bool {
    
    return false
}

func calendar(_ calendar: CalendarView, didLongPressDate date: Date, withEvents events: [CalendarEvent]?) {
    
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant