登录 立即注册
金钱:

Code4App-iOS开发-iOS 开源代码库-iOS代码实例搜索-iOS特效示例-iOS代码例子下载-Code4App.com

高度自定义日期选择器

[复制链接]
来自: DreamOfXM 分类: iOS精品源码 上传时间: 2017-3-14 10:11:07
Tag:界面布局 视图 日历 动画 列表

项目介绍:

XMDatePicker

This is a datePicker which you can set as what you want(这个时间选择器你可以自由定义).

1 How to use

1.1 You can set datepicker's label color

self.datePicker.selectedLabelColor = [UIColor yellowColor];

self.datePicker.otherLabelColor = [UIColor blueColor];

1.2 You can set datePicker's text

self.datePicker.selectedTextFont = [UIFont systemFontOfSize:17];
self.datePicker.selectedTextColor = [UIColor blueColor];

self.datePicker.otherTextFont = [UIFont systemFontOfSize:15];
self.datePicker.otherTextColor = [UIColor grayColor];

1.3 You can set separator's color and width

// color
self.datePicker.seperateLineColor = [UIColor redColor];
//width
self.datePicker.seperatorWidth = 60;

1.4 You can select datePicker separator's type. There are three types by default.  

//Default

self.datePicker.pickerViewType = PickerViewTypeLongSperator;

//Dynamic seperate line

self.datePicker.pickerViewType = PickerViewTypeDynamicSperator;

//Static seperate line

self.datePicker.pickerViewType = PickerViewTypeStaticSperator;

1.5 Date show type.There are five types by default.

//yyyy-MM-dd HH:mm

 self.datePicker.dateShowType = DateShowingTypeYMDHM;

//yyyy-MM-dd HH

self.datePicker.dateShowType = DateShowingTypeYMDH;

//yyyy-MM-dd

self.datePicker.dateShowType = DateShowingTypeYMD;

//MM-dd HH:mm

self.datePicker.dateShowType = DateShowingTypeMDHM;

//dd HH:mm

self.datePicker.dateShowType = DateShowingTypeDHM;

1.6 You are free to set row height and component width of the datePicker

 self.datePicker.componentWidth = 70;
 self.datePicker.rowHeight = 30;

1.7 You can set date unit

 self.datePicker.yearUnit = @"年";
 self.datePicker.monthUnit = @"月";
 self.datePicker.dayUnit = @"日";
 self.datePicker.hourUnit = @"时";
 self.datePicker.miniteUnit = @"分";

picture 1

image

picture 2

image

picture 3

image

2 usage

2.1 cocoaPods

pod XMDatePicker

2.2 Manual import

1 Drag all files in the XMDatePicker folder to your progect

2 improt the main file  #import "XMDatePicker.h"

3 Method excute

3.1 Excute - (void)showPickerView

(调用方法- (void)showPickerView展示pickerView)

3.2 Implement protocol method

There are two protocol methods Which are - (void)pickerView:(XMDatePicker *)pickerView didSelectedDateString:(NSString *)dateString and - (void)pickerView:(XMDatePicker *)pickerView didClickOkButtonWithDateString:(NSString *)dateString.

If you need not click the confirmation button transmit date strings, you can implement the first method, otherwise the second.


有两个代理方法,分别是- (void)pickerView:(XMDatePicker *)pickerView didSelectedDateString:(NSString *)dateString- (void)pickerView:(XMDatePicker *)pickerView didClickOkButtonWithDateString:(NSString *)dateString,如果你不需要点击“确认”按钮去最终确定所选择的日期,而是滑动转轮的同时更新日期,那么你可以实现第一个代理方法,否则就实现第二个代理方法

 3 Issue

If you find a bug, please tell me.My E-mail address is 1179102890@qq.com. If you have a good idea ,you can discuss with me.

最后,我在《XMDatePicker的写作思路》中简要讲了一下处理分割线的问题,有什么问题希望大家批评指正!


github地址:
https://github.com/DreamOfXM/XMDatePicker
code4app

相关源码推荐:

    我来说两句
    *滑动验证:
    所有评论(13)
    565691320 2017-3-20 10:36:25
    内容很好,棒棒哒
    回复
    1005332621 2017-3-20 11:14:19
    感谢分享,Code4App有你更精彩:)
    回复
    code4app热心网友 2017-3-20 11:48:24
    学习学习!
    回复
    code4app热心网友 2017-3-20 14:17:03
    虽不明,但觉厉!
    回复
    yelling 2017-3-20 15:11:44
    楼主用心了,内容非常精彩。
    回复
    15286427087 2017-3-20 16:05:46
    楼主用心了,内容非常精彩。
    回复
    凌晨_RC3qH 2017-3-20 16:24:40
    强烈支持楼主ing……
    回复
    code4app热心网友 2017-3-20 19:10:39
    精华内容,楼主V5!
    回复
    baoxin147 2017-3-21 09:40:48
    感谢分享,Code4App有你更精彩:)
    回复
    12下一页
    提取码:  下载次数:49 状态:已购或VIP 售价:0(原价:10)金钱 下载权限:初级码农 
    489 2 49
    相关代码
      联系我们
      首页/微信公众账号投稿

      帖子代码编辑/版权问题

      QQ:435399051,742864542

      如何获得代码达人称号?

      代码贡献英雄榜
      用户名 下载数
      代码分类
      通过邮件订阅最新 Code4App 信息
      上一条 /4 下一条
      联系我们
      关闭
      合作电话:
      13802416937
      Email:
      435399051@qq.com
      商务市场合作/投稿
      问题反馈及帮助
      联系我们

      广告投放| Github|申请友链|手机版|Code4App ( 粤ICP备15117877号-1 )

      快速回复 返回顶部 返回列表