Briefly
In the application of some settings often need to use some picker to quickly help users select the value, the general use of Uidatepicker,uipickerview and Uiimagepickercontroller.
Initial interface
As shown in the diagram, in the construction of a good interface, implementation methods to complete the various options. First, date selection.
Uidatepicker
The main attributes that need to be set are
Locale
Datepickermode
Uidatepicker *datepicker = [[Uidatepicker
alloc] init];
Datepicker.locale = [[Nslocale alloc] initwithlocaleidentifier:@ "ZH_HANS_CN"];
Datepicker.datepickermode = uidatepickermodedate;
NSString *stddate = @ "1990-01-01";
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
Formatter.dateformat = @ "Yyyy-mm-dd";
[DatePicker setdate:[formatter datefromstring:stddate] animated:yes];
[DatePicker addtarget:self Action: @selector (showdate:)
forcontrolevents:uicontroleventvaluechanged];
_datefield.inputview = DatePicker;
_datefield.text = stddate;