ios 时间选择器月份设置中文_iOS最全的日期选择器】PGDatePicker
项目介绍:日期选择器,支持年、年月、年月日、时分、年月周 时分等。由于使用UIPickerView的话,列表会有个弧度,所以这里用了https://github.com/xiaozhuxiong121/PGPickerViewGitHub地址https://github.com/xiaozhuxiong121/PGDatePickerCocoaPods安装pod 'PGDatePicker'使用P
项目介绍:
日期选择器,支持年、年月、年月日、时分、年月周 时分等。
由于使用UIPickerView的话,列表会有个弧度,所以这里用了https://github.com/xiaozhuxiong121/PGPickerView
GitHub地址
https://github.com/xiaozhuxiong121/PGDatePicker
CocoaPods安装
pod 'PGDatePicker'
使用
PGDatePicker *datePicker = [[PGDatePicker alloc]init];
datePicker.delegate = self;
[datePicker show];
datePicker.datePickerMode = PGDatePickerModeYear;
#pragma PGDatePickerDelegate
- (void)datePicker:(PGDatePicker *)datePicker didSelectDate:(NSDateComponents *)dateComponents {
NSLog(@"dateComponents = %@", dateComponents);
}
设置Date
建议用NSDate+PGCategory类所定义的方法去设置
+ (NSDate *)setYear:(NSUInteger)year;
+ (NSDate *)setYear:(NSUInteger)year month:(NSUInteger)month;
+ (NSDate *)setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day;
+ (NSDate *)setMonth:(NSUInteger)month day:(NSUInteger)day hour:(NSInteger)hour minute:(NSInteger)minute;
+ (NSDate *)setHour:(NSInteger)hour minute:(NSInteger)minute;
比如:datePicker.maximumDate = [NSDate setYear:2017];
更多推荐
所有评论(0)