SACalendar

效果图:

Introducing SACalendar - Easy to use and customizable iOS 7 Calendar

SACalendar - 使用非常傻瓜,非常便于定制

Only need 3 lines of code to set up. Every view customizable to fit your need.

只需要3行代码,所有的事情就做好了

This project uses the customized version of DMLazyScrollView (https://github.com/malcommac/DMLazyScrollView)

这个源码中部分使用到了DMLazyScrollView (https://github.com/malcommac/DMLazyScrollView)

Installation

  • Add the SACalendar folder into your project. Make sure the "copy items into destination group's folder" box is checked 将SACalendar添加到你的项目当中,记得勾选“folder”

  • Done 完啦

Basic Usage

Import the class header

引入头文件

#import "SACalendar.h"

Initialize your calendar with the appropriate frame. The calendar will scale to fit your frame automatically.

初始化你的日历的frame值,这个日历会自动适配你的frame值的,这点放心

- (void)viewDidLoad
{
[super viewDidLoad]; SACalendar *calendar = [[SACalendar alloc]initWithFrame:CGRectMake(0, 20, 320, 400)]; calendar.delegate = self; [self.view addSubview:calendar];
}

Delegate (optional)

SACalendar provides two delegate methods. didSelectDate gets called when a user click on a specific date. didDisplayCalendarForMonth gets called when the user swipe the calendar to a different month. To use it, implement the delegate in your view controller.

SACalendar提供两个代理方法。当一个日期被点击时didSelectDate会被调用。用户滑动切换月份时,didDisplayCalendarForMonth会被调用。将代理引入到你的控制器中即可使用。

@interface ViewController () <SACalendarDelegate>

Then implement the optional delegate functions

以下是两个可选的代理方法

// Prints out the selected date
-(void) SACalendar:(SACalendar*)calendar didSelectDate:(int)day month:(int)month year:(int)year
{
NSLog(@"%02i/%02/%i",month,year);
} // Prints out the month and year displaying on the calendar
-(void) SACalendar:(SACalendar *)calendar didDisplayCalendarForMonth:(int)month year:(int)year{
NSLog(@"%02/%i",month,year);
}

Customize

  • To customize the view properties such as cell size, font, colors, please see the class 为了定制view的属性,例如cell的size,font,colors,你可以到cell中去看看
SACalendarConstants.h

All ratio and UI constants are defined in this class. Change them to support your need.

所有的参数与样式都是在这个类中被定义了。你可以随意修改来达到你的需求。

  • To customize the logic behind what's being displayed in the cells (i.e. red circle at selected date), see this function in SACalendar.m 你可以查看SACalendar.m文件来自定义cell背后的逻辑
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  • To customize the components (subviews) of the cell or to add some views to the cell, please see this function in SACalendarCell.m 你可以查看SACalendarCell.m文件来自定义cell的显示样式
- (id)initWithFrame:(CGRect)frame

[翻译] SACalendar的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. java.lang.ArithmeticException: Rounding necessary

    这个错误就是精度丢失问题 https://blog.csdn.net/qq496013218/article/details/70792655

  2. java-jdk7-forkjoin异常返回

    来自:http://ifeve.com/fork-join-5/ 在Java中有两种异常: 已检查异常(Checked exceptions):这些异常必须在一个方法的throws从句中指定或在内部捕 ...

  3. 面试:C/C++常见库函数实现

    1. void *mymemcpy(void *dest, const void* src, size_t n): 内存拷贝函数,memcpy函数的功能是从源src所指的内存地址的起始位置开始拷贝n个 ...

  4. Nodejs学习笔记(一)—简介及安装Node.js开发环境

    一.简介 Node.js是让Javascript脱离浏览器运行在服务器的一个平台,不是语言: Node.js采用的Javascript引擎是来自Google Chrome的V8:运行在浏览器外不用考虑 ...

  5. JS的可枚举性

        在学习ES6的过程中,涉及到遍历方法时,提到过可枚举性,且多种遍历方法都与可枚举性相关.本章节,将总结这些遍历方法的可枚举性,并在必要的部分,给出对比实例. 一.设置属性的可枚举性 在上一文章 ...

  6. oracle 一对多数据分页查询筛选

    今天项目测试运行的时候,遇到了一个奇怪的问题,这个问题说起来按sql语法的话是没有错误的 但是呢按照我们的业务来做区分就有些逻辑上的错误了, 下面请听我慢慢道来,在数据库中有两个数据, 先来看下第一次 ...

  7. Enable Scribble,Enable Guard Edges,Enable Guard Malloc,Zombie Objects

    最近项目中使用一个翻拍身份证信息识别活体检测的第三方框架,在使用时会偶然性的出现崩溃的现象,经过查找是因为第三方框架中有释放的内存区域再次引用引起的,因而补充一下相关知识点.   在Xcode Edi ...

  8. POJ 2480 Longge's problem 欧拉函数—————∑gcd(i, N) 1<=i <=N

    Longge's problem Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6383   Accepted: 2043 ...

  9. Eclipse发布的Dynamical web项目在Tomacat文件夹下显示

    Eclipse设置了Tomacat后,项目信息会在你的workspace上,在Tomacat文件夹上是没有的.但是通过设置是可以在Tomacat文件夹上存在的. 配置好服务器后,先关闭服务器,然后在E ...

  10. HDU2612(KB1-N)

    Find a way Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...