日历 0.1

日历 0.1

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后版本2015年6月
SPM支持SPM

Lancy Norbert Fernandes维护。



日历 0.1

  • Lancy Norbert Fernandes

由Swift编写的iOS日历组件

使用方式

  1. CalendarKit文件夹拖到您的项目目录中。
  2. 您可以将日历添加到占位符视图,因此创建一个为其创建的出口。
    @IBOutlet var placeholderView: UIView!
  3. 您的Viewcontroller中的viewDidLoad方法应如下所示

    override func viewDidLoad() {
        super.viewDidLoad()
    
        // todays date.
        let date = NSDate()
    
        // create an instance of calendar view with 
        // base date (Calendar shows 12 months range from current base date)
        // selected date (marked dated in the calendar)
        let calendarView = CalendarView.instance(date, selectedDate: date)
        calendarView.delegate = self
        calendarView.setTranslatesAutoresizingMaskIntoConstraints(false)
        placeholderView.addSubview(calendarView)
    
        // Constraints for calendar view - Fill the parent view.
        placeholderView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[calendarView]|", options: NSLayoutFormatOptions(0), metrics: nil, views: ["calendarView": calendarView]))
        placeholderView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[calendarView]|", options: NSLayoutFormatOptions(0), metrics: nil, views: ["calendarView": calendarView]))
    }
  4. 实现代理方法
    func didSelectDate(date: NSDate) {
        println("(date.year)-(date.month)-(date.day)")
    }
    请确保您的Viewcontroller类符合CalendarViewDelegate协议。

截图

许可证

MIT许可证(MIT)

版权(c)2015 Lancy

特此授予任何获得此软件及其相关文档文件(“软件”)副本的人免费使用软件的权利,包括但不限于以下权利:使用、复制、修改、合并、发布、分发、再许可,以及允许他人因软件而受遣送的人使用软件,受以下条件限制:

上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。

软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、适用于特定目的和无侵犯性的保证。在没有任何事件,无论出于合同、侵权或其它原因,作者或版权所有者均不对任何索赔、损害或其他责任负责,这些索赔、损害或其他责任源自、源于或与软件或其使用或其它交易有关。