HooDatePicker 介绍(introduction)

==================================================
项目需要一个DatePicker,只显示年月,而且选中的时间高亮显示(苹果默认的只显示灰色),研究多个代码后没有达到预想效果,没办法只能动手丰衣足食,用了一天时间封装出这个性能比较高的自定义DatePicker。苹果原生的UIDatePicker无法实现只提供年月选择,而HooDatePicker增加了年月显示,并提供了扁平化和样式美化,也更加符合中国人的时间习惯。
A customized DatePicker. which can show only Years and months.the UIDatePicker don't achive this. and HooDatePicker looks much more beautiful than UIDatePicker.I hope you can like it.

Github address

==================================================
(Github下载地址):https://github.com/jakciehoo/HooDatePicker

效果图展示(picure show):

==================================================
HooDatePickerModeDate Demo picture:

Simulator Screen Shot Mar 6, 2016, 3.04.09 AM.png

HooDatePickerModeYearAndMonth Demo picture

Simulator Screen Shot Mar 6, 2016, 3.04.30 AM.png

如何使用How To Use:

==================================================

HooDatePicker *datePicker = [[HooDatePicker alloc] initWithSuperView:self.view];
datePicker.delegate = self;
datePicker.datePickerMode = HooDatePickerModeYearAndMonth;
[datePicker show];
[datePicker dismiss];
 

更多用法More:

==================================================
1.设置其他属性

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd-MM-yyyy HH:mm:ss"];
NSDate *maxDate = [dateFormatter dateFromString:@"01-01-2050 00:00:00"];
NSDate *minDate = [dateFormatter dateFromString:@"01-01-2016 00:00:00"];
[self.datePicker setDate:[NSDate date] animated:YES];//设置默认日期
self.datePicker.minimumDate = minDate;//设置显示的最小日期
self.datePicker.maximumDate = maxDate;//设置显示的最大日期
[self.datePicker setTintColor:[UIColor redColor]];//设置主色
[self.datePicker setHighlightColor:[UIColor yellowColor]];//设置高亮颜色

2.相关代理

@protocol HooDatePickerDelegate<NSObject>
@optional
- (void)datePicker:(HooDatePicker *)datePicker dateDidChange:(NSDate *)date;
- (void)datePicker:(HooDatePicker *)datePicker clickedCancelButton:(UIButton *)sender;
- (void)datePicker:(HooDatePicker *)datePicker clickedSureButton:(UIButton *)sender date:(NSDate*)date;
@end

For more detail, you can download this project and see demo code in it.

Enjoy it!!

欢迎关注我的微信公众号“丁丁的coding日记”,一起学习iOS开发技术

自定义一个只显示年月的DatePicker(UIDatePicker无法实现年月显示)的更多相关文章

  1. 使用VideoView自定义一个播放器控件

    介绍 最近要使用播放器做一个简单的视频播放功能,开始学习VideoView,在横竖屏切换的时候碰到了点麻烦,不过在查阅资料后总算是解决了.在写VideoView播放视频时候定义控制的代码全写在Actv ...

  2. 自定义View(7)官方教程:自定义View(含onMeasure),自定义一个Layout(混合组件),重写一个现有组件

    Custom Components In this document The Basic Approach Fully Customized Components Compound Controls ...

  3. ExtJs5_继承自定义一个控件

    Extjs的开发都可以遵循OOP的原则,其对类的封装也很完善了.自定义一个控件最简单的办法就是继承一个已有的控件.根据上一节的需要,我做了一个Button的子类.首先根据目录结构,在app目录下建立一 ...

  4. 6、手把手教你Extjs5(六)继承自定义一个控件

    Extjs的开发都可以遵循OOP的原则,其对类的封装也很完善了.自定义一个控件最简单的办法就是继承一个已有的控件.根据上一节的需要,我做了一个Button的子类.首先根据目录结构,在app目录下建立一 ...

  5. 自定义一个更好用的SwipeRefreshLayout(弹力拉伸效果详解)(转载)

    转自: 自定义一个更好用的SwipeRefreshLayout(弹力拉伸效果详解) 前言 熟悉SwipeRefreshLayout的同学一定知道,SwipeRefreshLayout是android里 ...

  6. jQuery Validate 表单验证插件----自定义一个验证方法

    一.下载依赖包 网盘下载:https://yunpan.cn/cryvgGGAQ3DSW  访问密码 f224 二.引入依赖包 <script src="../../scripts/j ...

  7. JSTL,自定义一个标签的功能案例

    1.自定义一个带有两个属性的标签<max>,用于计算并输出两个数的最大值: 2.自定义一个带有一个属性的标签<lxn:readFile  src=“”>,用于输出指定文件的内容 ...

  8. 一个只需要点 「下一步」就完成监控 Windows

    Cloud Insight 此前已然支持 Linux 操作系统,支持20多中数据库中间件等组件,多种操作,多种搭配,服务器监控玩的其乐无穷啊!但想想还有许多 Windows 的小伙伴没有体验过,所以在 ...

  9. C#特性:从自定义一个特性开始,谈谈什么是特性

    作为C#新手中的一员,我刚开始接触特性时,那真是一脸冏逼啊,怎么想怎么查资料都没弄明白它到底是个什么东西,有的入门教程甚至都没讲特性和反射这些概念!相信很多人第一次接触到特性就是关于系列化的知识了. ...

随机推荐

  1. viewPager + fragment

    有两种实现方式,一种是 fragmentActivity + FragmentPagerAdapter (Fragment,FragmentManager需要导包:android.support.v4 ...

  2. 转载:Maven项目mybatis Invalid bound statement (not found)解决方法

    在mapper代理的开发中,程序员需要遵守一些规范,mybatis才能实现mapper接口的代理对象. 它的规范如下: mapper.xml的namespace要写所映射接口的全称类名. mapper ...

  3. 打开hibernate文件报警告

    在web工程中新建一个,Hibetnate项目,打开配置文件报警高错误,This project is not a MyEclipse Hiberbate Project. Assuming Hibe ...

  4. linux centos 安装mysql

    安装步骤 http://www.cnblogs.com/gaojupeng/p/5727069.html 下面这个报错 主要还是在 题啊加软连接的   命令出了问题 1.启动  报错 mysqld_s ...

  5. BIOS MCSDK 2.0 学习笔记(一)

    MCSDK简介 BIOS MCSDK是为TI的高性能多核DSP提供的一套组件,包括: SYS/BIOS实时操作系统 Chip support libraries, drivers, and basic ...

  6. ActiveReports中如何在后台导出运行时绑定数据源报表

    ActiveReports支持运行时绑定数据源功能,这种绑定数据源方法使用较为普及,然而很多系统中都需要在后台导出报表文件,所以用户就很困惑,ActiveReports中如何在后台导出运行时绑定数据源 ...

  7. nodejs新建服务器

    var http = require('http');// var optfile = require('./models/optfile'); http.createServer(function ...

  8. 如何在MySql中记录SQL日志记录

    My SQL可以用下面方法跟踪sql 语句,以下方法以Windows平台为例,linux雷同:   1  配置my.ini文件(在安装目录,linux下文件名为my.cnf     查找到[mysql ...

  9. AFNetworking之于https认证

    写在开头: 本来这篇内容准备写在AFNetworking到底做了什么?(三)中的,但是因为我想在三中完结这个系列,碍于篇幅所限.并且这一块内容独立性比较强,所以单独拎出来,写成一篇. 本文从源码的角度 ...

  10. C++ 标准库string字符串的截取

    标准库的string有一个substr函数用来截取子字符串.一般使用时传入两个参数,第一个是开始的坐标(第一个字符是0),第二个是截取的长度. #include <iostream> #i ...