[翻译] SACalendar
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的更多相关文章
- 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...
- 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...
- [翻译]开发文档:android Bitmap的高效使用
内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...
- 【探索】机器指令翻译成 JavaScript
前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...
- 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...
- 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...
- 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...
- 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?
0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...
- ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点
在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...
随机推荐
- Python的Django框架中forms表单类的使用方法详解
用户表单是Web端的一项基本功能,大而全的Django框架中自然带有现成的基础form对象,本文就Python的Django框架中forms表单类的使用方法详解. Form表单的功能 自动生成HTML ...
- imx6的kernel3.4.15启动流程
//最开始的定义为 DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad/DualLite (Device Tree)") .smp = sm ...
- Java使用Redisson分布式锁实现原理
本篇文章摘自:https://www.jb51.net/article/149353.htm 由于时间有限,暂未验证 仅先做记录.有大家注意下哈(会尽快抽时间进行验证) 1. 基本用法 添加依赖 &l ...
- spring MethodInterceptor方法拦截
引用别的的:https://blog.csdn.net/u010739551/article/details/47754731 最近项目里加上了用户权限,有些操作需要登录,有些操作不需要,之前做项目做 ...
- Sourcetree报错: 您没有已经配置扩展集成设置的远端
一.错误提示 您没有已经配置扩展集成设置的远端; ... 二.解决 配置 Legacy Account Settings 即可:
- jstack,jmap,jstat分别的意义
1.Jstack 1.1 jstack能得到运行java程序的java stack和native stack的信息.可以轻松得知当前线程的运行情况.如下图所示 注:这个和thread dump是同 ...
- servlet(一):从Sevlet到HttpServlet
Java Servlet 是运行在 Web 服务器或应用服务器上的程序,它是作为来自 Web 浏览器或其他 HTTP 客户端的请求和 HTTP 服务器上的数据库或应用程序之间的中间层. servlet ...
- 关于在web端运行项目,eclipse报PermGen space错误
之前在网上也查到过许多解决的方法,但可能因为本人脸黑........也修改过eclipse文件目录中的相关配置文件,并没有得到相应的帮助,因此把自己的改正方法分享下: window-->pref ...
- 记录:springmvc + mybatis + maven 搭建配置流程
前言:不会配置 spring mvc,不知道为什么那样配置,也不知道从何下手,那么看这里就对了. 在 IDEA 中搭建 maven + springmvc + mybatis: 一.在 IDEA 中首 ...
- Q:链表的倒数第K个元素
问题:如何得到链表中的倒数第k个元素? 一种简单的思路是遍历链表一遍,并统计出链表中节点的数目,然后计算出倒数第k个元素到链表头节点的元素的距离,然后得到对应的结果.但是,我们能否有一种更加简便的 ...