WHTimePicker 1.0.8

WHTimePicker 1.0.8

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Oct 2017

Maintained by wuhao.



  • By
  • wuhao

好用的时间选择器,
pod ‘WHTimePicker’
如果没找到, 请先pod setup, 然后再pod ‘WHTimePicker’

!注意:需要用到 Masonry 框架

在WHTimePicker.h文件中导入了#import "Masonry.h"
如果你的项目中没有Masonry,会自动帮你导入Masonry

img

使用方法

  1. 导入头文件
 a>> 直接在本网页下载使用:#import "WHTimePicker.h"
 b>> 或者利用CocoaPods安装到项目中:#import <WHTimePicker.h>
  1. 添加代理
@interface ViewController () <WHPickerDelegate>
  1. 初始化创建WHTimePicker
- (void)setupTimePicker{
    // 快速创建
    WHTimePicker *timePicker = [WHTimePicker timePickerWithType:DateArray];
    timePicker.delegate = self;
    // 显示时间选择器
    [timePicker show];

    // 顶部确定栏背景颜色,默认天蓝色
    picker.topTitleColor = [UIColor lightGrayColor];
    // 顶部"确定","类型","取消"按钮的文字颜色,默认白色
    picker.topBackColor = [UIColor blackColor];
}
  1. 实现代理方法一
/** 代理方法一 返回选择的字符串*/
- (void)getSelectedString:(NSString *)string {
    NSLog(@"你选择了%@",string);
   [button setTitle:string forState:UIControlStateNormal];
}
  1. 实现代理方法二
/** 代理方法二 时间选择器消失的时候回调*/
- (void)timePickerDisappare {
    NSLog(@"时间选择器消失了~");
}

MIT LICENSE