-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewController.m
More file actions
64 lines (52 loc) · 1.99 KB
/
Copy pathViewController.m
File metadata and controls
64 lines (52 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// ViewController.m
// HTDevelopTools
//
// Created by apple on 2017/11/22.
// Copyright © 2017年 HT. All rights reserved.
//
#import "ViewController.h"
#import "HTCustomVCViewController.h"
@interface ViewController ()
{
HTDatePickerView *dataPicker;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(100, 100, 200, 50);
[btn ht_setButtonTitle:@"推出时间选择器" titleFont:FontWidth(14) titleColor:[UIColor redColor] forState:0];
[btn addTarget:self action:@selector(clickBtn) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
// Do any additional setup after loading the view, typically from a nib.
UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 200, 200, 50)];
timeLabel.textColor = [UIColor redColor];
timeLabel.textAlignment = 1;
timeLabel.text = @"时间";
[self.view addSubview:timeLabel];
dataPicker = [HTDatePickerView htDatePickerViewWithFrame:CGRectMake(0, SCREEN_H, SCREEN_W, Height(260)) style:HTDatePickerStyle_YMDhms];
dataPicker.cancelBlock = ^{
NSLog(@"取消");
};
dataPicker.ensureBlock = ^(NSString *date) {
NSLog(@"时间是:%@", date);
timeLabel.text = date;
};
dataPicker.isCanSelectCurrentTimeBefore = YES;
dataPicker.buttonBorderColor = [UIColor redColor];
dataPicker.cancelBtnColor = [UIColor redColor];
[self.view addSubview:dataPicker];
}
- (void)clickBtn{
// HTCustomVCViewController *vc = [[HTCustomVCViewController alloc] initCustomNavWithTitle:@"自定义导航条" backBtnImageStr:@"tuichu"];
// [self presentViewController:vc animated:YES completion:nil];
[dataPicker showDatePicker];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end