Code Monkey home page Code Monkey logo

cjcalendar's Introduction

CJCalendar

这是一个可以显示农历和公历的日历控制器

image

image

image

使用这个日历灰常简单 只要把calendar拖到你的项目中,就可以直接用了

步骤:

一 初始化

初始化控制器,代理监听,设置大小

  CJCalendarViewController *calendarController = [[CJCalendarViewController alloc] init];
  calendarController.view.frame = self.view.frame;
  calendarController.delegate = self;

二 添加控制器

  [self presentViewController:calendarController animated:YES completion:nil];

三 实现代理方法

可选代理方法,用来接受返回的年月日

-(void)CalendarViewController:(CJCalendarViewController *)controller didSelectActionYear:(NSString *)year month:(NSString *)month day:(NSString *)day;

可选的方法/属性

一 指定初始时间

默认不指定就是当前时间

/** 直接指定时间 */
@property (nonatomic, strong) NSDate *Date;
/** 传入年、月、日 ,设置时间 */
-(void) setYear:(NSString *)year month:(NSString *)month day:(NSString *)day;

二 指定颜色

//以下属性均有默认值
/** HeaderColor default white 上部显示区域标题的颜色*/
@property (nonatomic, copy) UIColor *headerColor;
/** HeaderBackgroundColor default rgb (60, 45, 140) 上部显示区域标题栏背景颜色 */
@property (nonatomic, copy) UIColor *headerBackgroundColor;
/** contentColor default white 上部显示区域内容文本颜色*/
@property (nonatomic, copy) UIColor *contentColor;
/** contentBackgroundColor default rgb (71, 55, 169) 上部显示区域内容背景颜色*/
@property (nonatomic, copy) UIColor *contentBackgroundColor;

例如

    calendarController.headerBackgroundColor = [UIColor purpleColor];
    calendarController.headerColor = [UIColor whiteColor];
    calendarController.contentColor = [UIColor whiteColor];
    calendarController.contentBackgroundColor = [UIColor purpleColor];

三 制定背景色和透明度

默认透明度0.8 黑色 (ios8+)

-(void) setBgAlpha:(CGFloat)alpha color:(UIColor *)bgColor;

#####目前,这个控制器还是相对简陋的,还有完善的空间 - 控制器中的"取消"按钮只是实现了 modal的推出, - 还没有做缓存相关的操作 - 目前只是在单线程中完成所有工作




学习阶段,请各位大神指点一二 (抱拳)

持续......

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.