Today Liu Guobin Teacher spoke two new control Uidatespickers/uialertcontroller, one is a date selector, and the other is a warning window controller.
One, the development uses the date time picker uidatepicker experience. Uidatepicker inheritance with Uicontrol, you can use Uicontrol method -(void) AddTarget: (ID) Target action: (SEL) Action forcontrolevents: ( uicontrolevents) ControlEvents Gets the date time selected. set the display language, 12/24 hours of input, get local time, and limit the selection of time selection; format displays the date and time required for the output to be displayed.
Uidatepicker *tp=[[uidatepicker Alloc]init];
The Uidatepickermodedateandtime enumeration value is 2, and the default property enumeration for general system settings is 0, which is a special
Uidatepickermodedateandtime is the system default, self and set at the time for this
Tp.datepickermode=uidatepickermodedateandtime;
Gets the style (language) that can be tagged//specifies the region in which the selector is located (the language displayed) Chinese "zh_hans_cn" English "en_US"
NSLog (@ "%@", [Nslocale availablelocaleidentifiers]);
Tp.locale=[nslocale localewithlocaleidentifier:@ "BJ_CN"];
Timer ****************
Tp.datepickermode=uidatepickermodecountdowntimer;
Countdown duration, setting the time interval
tp.countdownduration=60*30; Units: seconds/But the minimum screen display is minutes, so multiply by 60, set when the current initial time
tp.minuteinterval=10; Units: Minutes
[Self.view ADDSUBVIEW:TP];
[TP addtarget:self Action: @selector (DoClick) forcontrolevents:uicontroleventvaluechanged];
// ***********************************
SELF.TP=TP;
}
Events that start when you click on a value change
-(void) doclick{
NSLog (@ "hehe");
}
-(void) moo{
The time of the acquisition is the time of the Observatory, which is to be converted into our own time.
NSLog (@ "%@", self.tp.date);
};
Two
-(void) moo{
In Actionsheet mode, the bottom of the screen is the exclusive line
Uialertaction *okaction=[uialertaction actionwithtitle:@ "OK" style:uialertactionstyledefault Handler:nil];
Uialertaction *cancelaction=[uialertaction actionwithtitle:@ "Cancel" Style:uialertactionstylecancel Handler:nil];
Block
Uialertaction *reaction=[uialertaction actionwithtitle:@ "Restart" Style:uialertactionstyledefault handler:^ ( Uialertaction * _nonnull action) {
^ is a feature of block
[Self rego];
Here you can jump directly to the event method, or you can individually encapsulate the method written on the outside of the call here
NSLog (@ "www");
}];
Create Uialertcontroller
Uialertcontroller *ac=[uialertcontroller alertcontrollerwithtitle:@ "Warning" message:@ "content of Prompt" Preferredstyle: Uialertcontrollerstylealert];
Add button
[AC addaction:okaction];
[AC addaction:cancelaction];
[AC addaction:reaction];
Jump to alert window
[Self Presentviewcontroller:ac animated:yes completion:nil];
Lan Yi iOS new control Uidatespickers/uialertcontroller