1.Locale
Sets the DatePicker region, which is the language to set the DatePicker display.
1. Track all available areas and remove the desired area
NSLog (@ "%@", [Nslocale availablelocaleidentifiers]);
2. Setting the region of the date selection control
[DatePicker setlocale:[[nslocale alloc]initwithlocaleidentifier:@ "ZH_HANS_CN"];
Effect:
[DatePicker setlocale:[[nslocale alloc]initwithlocaleidentifier:@ "EN_SC"];
Effect:
2.Calendar
Set the DatePicker calendar.
The default is the current day.
[DatePicker Setcalendar:[nscalendar Currentcalendar];
3.timeZone
Set the time zone for the DatePicker.
The default is set to: [DatePicker Settimezone:[nstimezone Defaulttimezone]];
4.date
Set the date for the DatePicker.
The default setting is: [DatePicker setdate:[nsdate Date]];
5.minimumDate
Sets the minimum allowable date for DatePicker.
6.maximumDate
Sets the maximum allowable date for DatePicker.
7.countDownDuration
Set the countdown between DatePicker.
1) Set the mode of the date selection
[Self.datepicker Setdatepickermode:uidatepickermodecountdowntimer];
2) Set the duration of the countdown
Note: Setting the countdown length needs to be specified after determining the mode
The length of the countdown, in seconds
[Self.datepicker setcountdownduration:10 * 60];
Effect:
8.minuteInterval
You can set the split clock to show minutes at different intervals, provided that the interval is divisible by 60. The default interval is one minute. If you want to use a different interval, you need to change the Minuteinterval property:
Set the minute interval
Datepicker.minuteinterval = 15;
9.datePickerMode
9.1 Uidatepickermodetime,
Displays hour, minute, and optionally am/pm designation depending on the locale setting (e.g. 6 | 53 | PM)
Show hours, minutes and am/pm, this name is based on local settings
[DatePicker Setdatepickermode:uidatepickermodetime];
:
9.2 Uidatepickermodedate,
Displays month, day, and year depending on the locale setting (e.g. November | 15 | 2007)
Displays the name of the month date, based on the local settings
[DatePicker Setdatepickermode:uidatepickermodedate];
:
9.3 The default is to show this mode
Uidatepickermodedateandtime,//displays date, hour, minute, and optionally am/pm designation depending on the locale s Etting (e.g. Wed 15 | 6 | 53 | PM)
Displays the date, hour, minute, and AM/PM, and the name is based on local settings
[DatePicker Setdatepickermode:uidatepickermodedateandtime];
:
9.4
Uidatepickermodecountdowntimer//Displays hour and minute (e.g. 1 | 53)
Show hours and minutes
[DatePicker Setdatepickermode:uidatepickermodecountdowntimer];
:
Uidatepicker use tutorial one. 10.1 Initialization
Do not set the width height, because its width is fixed
Uidatepicker *datepicker = [[Uidatepicker alloc] init];
10.2 Common Settings
Set region to Chinese Simplified Chinese
Datepicker.locale = [[Nslocale alloc] initwithlocaleidentifier:@ "ZH_CN"];
To set the display mode for picker: Displays only the date
Datepicker.datepickermode = uidatepickermodedate;
10.3UIDatePicker need to change the listening value
[DatePicker addtarget:self Action: @selector (datechange:)forcontrolevents:uicontroleventvaluechanged];
11.UIDatePicker using tutorial two. 11.1 Date Range
You can specify the date range to use by setting the Mininumdate and Maxinumdate properties. If a user attempts to scroll to a date beyond this range, the dial rolls back to the most recent valid date. Two methods require the NSDate object as a parameter:
nsdate* mindate = [[NSDate alloc]initwithstring:@ "1900-01-01 00:00:00-0500"];
nsdate* maxdate = [[NSDate alloc]initwithstring:@ "2099-01-01 00:00:00-0500"];
Datepicker.minimumdate = MinDate;
Datepicker.maximumdate = MaxDate;
11.2 If any one of the two date range properties is not set, the default behavior will allow the user to select any past or future date. This is useful in some cases, for example, when you choose a birthday, it can be any date in the past, but terminates with the current date. If you want to set the date that is displayed by default, you can use the Date property: Datepicker.date = MinDate; 11.3 In addition, you can also use the SetDate method. If you select Use animation, the dial will scroll to the date you specify:
[DatePicker setdate:maxdate Animated:yes];
Brief introduction to the usage of Uidatepicker