MDCalendar 一个简单的日历demo

MDCalendar

a simple calendar demo as following

calendar.gif

using collectionview to realize the calendar

    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: String.init(describing: MADCalendarCell.self), for: indexPath) as! MADCalendarCell
        
        if indexPath.row < self.weekTitles.count {
            cell.titleLabel.text = self.weekTitles[indexPath.row]
        }else {
            let index = indexPath.row - self.weekTitles.count
            if index < self.currentMonthData.dayArr.count {                
                cell.model = self.currentMonthData.dayArr[index]
            }
        }
        return cell
    }

it is too simple,so i have no more thing to be written.

github demo

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,499评论 0 10
  • 1 android三种数据持久化存储技术 (1)文件存储:简单,不做格式化处理,适用于文本文件、二进制文件 (2)...
    努力科研的小树蛙阅读 643评论 0 0
  • 月升,人独坐。风起,叶漂泊。嗟叹红尘谁人知,荷塘一对鸳映过。昨日黄花皆已落,莫,莫,莫! 相见,似无语。不见,更落...
    和尘云阅读 393评论 0 1
  • 还在上小学的时候,对工作场景的认识就是,坐在空调室,面对电脑,一杯茶 ,一份报,一把椅子坐一天,所以一直对工作的印...
    王玲_阅读 233评论 0 1