提供了一个能够进行月,日切换的时间选择控制器。
- XXDatePickerViewController.h
- XXDatePickerViewController.m
- HooDatePicker.h
- HooDatePicker.m
- NSDate+HooDatePicker.h
- NSDate+HooDatePicker.m
- ViewController.h
- ViewController.m
- (void)topViewClicked; //主要是dismiss掉时间选择控制器
//获取到选中时间,并且dismiss掉时间选择控制器
- (void)sureButtonClicked:(NSDate *)date;
#pragma mark - XXDatePickerViewControllerDelegete
- (void)topViewClicked {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)sureButtonClicked:(NSDate *)date {
[self dismissViewControllerAnimated:YES completion:nil];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyy-MM-dd";
NSString *dateString = [formatter stringFromDate:date];
NSLog(@"dateString = %@",dateString);
}