项目作者: JoeCiou

项目描述 :
Calendar library for iOS
高级语言: Swift
项目地址: git://github.com/JoeCiou/JKCalendar.git
创建时间: 2017-04-17T03:11:12Z
项目社区:https://github.com/JoeCiou/JKCalendar

开源协议:MIT License

下载


JKCalendar


Carthage compatible
Version
Platform
Swift 3.x
Swift 4.0

Screenshot

Requirements

  • iOS 9.0+
  • Xcode 8+

Installation

CocoaPods

To install add the following line to your Podfile:

  1. pod 'JKCalendar'

Carthage

To install add the following line to your Cartfile:

  1. github "JoeCiou/JKCalendar"

Usage

Firstley, import JKCalendar

  1. import JKCalendar

Initialization

Then, there are to two ways you can create JKCalendar:

  • By storyboard, change class of any UIView to JKCalendar

Note: Set Module to JKCalendar.

  • By code, using initializer.
    1. let calendar = JKCalendar(frame: frame)

Mark

  1. public enum JKCalendarMarkType{
  2. case circle
  3. case hollowCircle
  4. case underline
  5. case dot
  6. }

For single mark:

For continuous mark:

Examples

Firstley, Setup data source:

  1. calendar.dataSource = self

For single mark:

  1. func calendar(_ calendar: JKCalendar, marksWith month: JKMonth) -> [JKCalendarMark]? {
  2. let today = JKDay(date: Date())
  3. if today == month{
  4. return [JKCalendarMark(type: .underline, day: today, color: UIColor.red)]
  5. }else{
  6. return nil
  7. }
  8. }

For continuous mark:

  1. func calendar(_ calendar: JKCalendar, continuousMarksWith month: JKMonth) -> [JKCalendarContinuousMark]?{
  2. let markStartDay = JKDay(year: 2017, month: 9, day: 3)!
  3. let markEndDay = JKDay(year: 2017, month: 9, day: 12)!
  4. if markStartDay == month || markEndDay == month{
  5. return [JKCalendarContinuousMark(type: .circle, start: markStartDay, end: markEndDay, color: UIColor.red)]
  6. }else{
  7. return nil
  8. }
  9. }

License

The MIT License (MIT)

copyright (c) 2017 Joe Ciou