JTCalendar

JTCalendar is a calendar control for iOS easily customizable.

JTCalendar 是一个很容易定制的日历的控件。

Usage

Basic usage - 基本使用方法

You have to create two views in your UIViewController.

你需要在你的UIViewController创建出两个view。

The first view is JTCalendarMenuView, it represents the months.

第一个view是JTCalendarMenuView,他代表着月份。

The second view is JTCalendarContentView, the calendar itself.

第二个view是JTCalendarContentView,这个是日历本身。

Your UIViewController must implement JTCalendarDataSource

你的UIViewController 必须实现JTCalendarDataSource代理。

#import <UIKit/UIKit.h>#import "JTCalendar.h" @interface ViewController : UIViewController<JTCalendarDataSource> @property (weak, nonatomic) IBOutlet JTCalendarMenuView *calendarMenuView; @property (weak, nonatomic) IBOutlet JTCalendarContentView *calendarContentView; @property (strong, nonatomic) JTCalendar *calendar; @end

JTCalendar is used to coordinate calendarMenuView and calendarContentView.

JTCalendar 是用来定位calendarMenuView与 calendarContentView的。

@implementation ViewController- (void)viewDidLoad
{[super viewDidLoad];self.calendar = [JTCalendar new]; [self.calendar setMenuMonthsView:self.calendarMenuView]; [self.calendar setContentView:self.calendarContentView]; [self.calendar setDataSource:self]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self.calendar reloadData]; // Must be call in viewDidAppear } - (BOOL)calendarHaveEvent:(JTCalendar *)calendar date:(NSDate *)date { return NO; } - (void)calendarDidDateSelected:(JTCalendar *)calendar date:(NSDate *)date { NSLog(@"%@", date); } @end 

Switch to week view

切换到week

If you want see just one week at time you can switch when you want between the weekMode.

如果你只想看一周的时间,你可以切换到weekMode模式

self.calendar.calendarAppearance.isWeekMode = YES;
[self.calendar reloadAppearance];

WARNING

注意

When you change the mode, it doesn't change the height of calendarContentView, you have to do it yourself. See the project in example for more details.

当你切换样式时,他并没有改变calendarContentView的高度,你需要自己手动设置。你可以在项目中找到实现细节。

Customize the design

自定义设计

You have a lot of options available for personnalize the design. Check the JTCalendarAppearance.h file for see all options.

你有这很多很多的选项来定制设计。你可以再JTCalendarAppearance.h文件中找到这些配置选项。

self.calendar.calendarAppearance.calendar.firstWeekday = 2; // Monday
self.calendar.calendarAppearance.ratioContentMenu = 1.;
self.calendar.calendarAppearance.menuMonthTextColor = [UIColor whiteColor];
self.calendar.calendarAppearance.dayCircleColorSelected = [UIColor blueColor]; self.calendar.calendarAppearance.dayTextColorSelected = [UIColor whiteColor]; [self.calendar reloadAppearance];

Recommendation

推荐用法

The call to reloadAppearance is expensive, reloadAppearance is call by setMenuMonthsView andsetContentView.

调用reloadAppearance 开销很大,setMenuMonthsView 与andsetContentView会调用reloadAppearance 方法

For better performance define the appearance just after instanciate JTCalendar.

BAD example:

self.calendar = [JTCalendar new];[self.calendar setMenuMonthsView:self.calendarMenuView];
[self.calendar setContentView:self.calendarContentView]; [self.calendar setDataSource:self]; self.calendar.calendarAppearance.calendar.firstWeekday = 2; // Monday self.calendar.calendarAppearance.ratioContentMenu = 1.; self.calendar.calendarAppearance.menuMonthTextColor = [UIColor whiteColor]; self.calendar.calendarAppearance.dayCircleColorSelected = [UIColor blueColor]; self.calendar.calendarAppearance.dayTextColorSelected = [UIColor whiteColor]; [self.calendar reloadAppearance]; // You have to call reloadAppearance

GOOD example:

self.calendar = [JTCalendar new];self.calendar.calendarAppearance.calendar.firstWeekday = 2; // Monday
self.calendar.calendarAppearance.ratioContentMenu = 1.;
self.calendar.calendarAppearance.menuMonthTextColor = [UIColor whiteColor]; self.calendar.calendarAppearance.dayCircleColorSelected = [UIColor blueColor]; self.calendar.calendarAppearance.dayTextColorSelected = [UIColor whiteColor]; [self.calendar setMenuMonthsView:self.calendarMenuView]; [self.calendar setContentView:self.calendarContentView]; [self.calendar setDataSource:self]; // You don't have to call reloadAppearance

You may also want to open your calendar on a specific date, by defaut it's [NSDate date].

你也许想在打开日历的时候定位到指定的日期,默认值是[NSDate date]

[self.calendar setCurrentDate:myDate];

Requirements

  • iOS 7 or higher
  • Automatic Reference Counting (ARC)

转载于:https://www.cnblogs.com/YouXianMing/p/4093660.html

[翻译] JTCalendar相关推荐

  1. Mysql函数group_concat、find_in_set 多值分隔字符字段进行数据库字段值翻译

    Mysql函数group_concat.find_in_set进行数据库字段值翻译 场景 配方表:记录包含的原料 sources表示原料,字段值之间用逗号分隔 原料表:对应原料id和原料名称 现需要查 ...

  2. “Attention is All You Need 翻译

    <p><img src="output_0_0.png" alt="png"></p> "Attention is ...

  3. 基于PyTorch的Seq2Seq翻译模型详细注释介绍(一)

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/qysh123/article/deta ...

  4. 全文翻译(全文合集):TVM: An Automated End-to-End Optimizing Compiler for Deep Learning

    全文翻译(全文合集):TVM: An Automated End-to-End Optimizing Compiler for Deep Learning 摘要 人们越来越需要将机器学习应用到各种各样 ...

  5. 全文翻译(四) TVM An Automated End-to-End Optimizing Compiler

    全文翻译(四) TVM An Automated End-to-End Optimizing Compiler 6.3 嵌入式GPU评估 对于移动GPU实验,在配备ARM Mali-T860MP4 G ...

  6. 全文翻译(三) TVM An Automated End-to-End Optimizing Compiler

    全文翻译(三) TVM An Automated End-to-End Optimizing Compiler 5. 自动化优化 考虑到一组丰富的调度原语,剩下的问题是为DL模型的每一层,找到最佳的算 ...

  7. 全文翻译(二): TVM: An Automated End-to-End Optimizing Compiler for Deep Learning

    全文翻译(二): TVM: An Automated End-to-End Optimizing Compiler for Deep Learning 3.优化计算图 计算图是在DL框架中表示程序的常 ...

  8. 全文翻译(一):TVM: An Automated End-to-End Optimizing Compiler for Deep Learning

    全文翻译(一):TVM: An Automated End-to-End Optimizing Compiler for Deep Learning 摘要 人们越来越需要将机器学习应用到各种各样的硬件 ...

  9. YOLOv4全文阅读(全文中文翻译)

    YOLOv4全文阅读(全文中文翻译) YOLOv4: Optimal Speed and Accuracy of Object Detection 论文链接: https://arxiv.org/pd ...

最新文章

  1. 千位亿万富豪调研:六成富豪担心继承人婚姻问题致财富外流
  2. BLAS+BLACS+LAPACK+SCALAPACK安装
  3. DPDK examples rxtx_callbacks完全注释
  4. 时间管理的十一条金律
  5. python编程入门第3版pdf-Python编程入门第三版
  6. PowerDesigner 11 一些小技巧
  7. java中int算法的有趣现象
  8. VS2013编译eXosip2-5.0.0
  9. lamp兄弟连 mysql_lamp兄弟连视频笔记
  10. emi软件测试,电磁干扰EMI的测试标准及应用
  11. 一天2篇Nature!任职同一高校,这对教授夫妻同时发表2项医学新成果
  12. java baas_GitHub - JavaBaas/JavaBaasServer at 2c4c9a2de05059984f513a976041c5787bf8edc2
  13. 计算机模拟地球爆炸,地球爆炸模拟器最新版
  14. 人工智能与智能的异同
  15. 一,用户操作过程中token过期了怎么续上?
  16. 2021年G1工业锅炉司炉考试及G1工业锅炉司炉证考试
  17. 不做人生规划,你离挨饿只有三天(转)
  18. 矢量图eps在word中的使用的方法
  19. FineBI物流行业可视化分析
  20. Qt 窗口操作函数(置顶、全屏,最大化最小化按钮设置等)

热门文章

  1. Flutter开发者必备手册 Flutter Go
  2. python内置函数中的 IO文件系列 open和os
  3. WiseCloud成为全球首批Kubernetes官方认证平台产品-CNCF官方发布
  4. 特定场景下SQL的优化
  5. Load-time relocation of shared libraries
  6. 追求代码质量: 监视圈复杂度
  7. 输入输出 scanf和*修饰符
  8. ***必须要掌握的计算机知识
  9. 可侦测多种眼疾的AI 系统 对不熟悉眼科的医疗照护人员极有帮助
  10. PostgreSQL 的 MVCC 机制解析