美文网首页IOS 拾遗
MDCalendar 一个简单的日历demo

MDCalendar 一个简单的日历demo

作者: madaoCN | 来源:发表于2018-11-01 11:05 被阅读4次

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

相关文章

网友评论

    本文标题:MDCalendar 一个简单的日历demo

    本文链接:https://www.haomeiwen.com/subject/jfwtxqtx.html