标签:
组件_DatePicket
/**
1.初始化
2.设置选择控件的格式
3.设置日期选择控件的地区
4.监听日期选择控件数值变化
**/
UIDatePicker *datePicker = [[UIDatePicker alloc]init];
[datePicker setDatePickerMode:UIDatePickerModeDate];
NSLog(@"%@", [NSLocale availableLocaleIdentifiers]);
[datePicker setLocale:[[NSLocale alloc]initWithLocaleIdentifier:@"zh_Hans_CN"]];
NSString *dateString = @"1949-10-1";
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"yyyy-MM-dd"];
NSDate *date = [formatter dateFromString:dateString];
NSDate *date = datePicker.date;
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"yyyy-MM-dd"];
标签:
原文地址:http://www.cnblogs.com/linxiu-0925/p/5058172.html