About using the prompt box in iOS
In IOS8 's SDK, the prompt box has been changed, now belongs to Uialertcontroller, and its interface is declared Ns_class_available_ios (8_0) @interface Uialertcontroller: Uiviewcontroller, is no longer a uiview.
The specific use of the following, I hope to help some friends.
#if __iphone_os_version_max_allowed >= __iphone_8_0//Determine the maximum iOS system version supported by your current iOS SDK
if (systermversion >= 8.0) {
Uialertcontroller *ALERTVC = [Uialertcontroller alertcontrollerwithtitle:@ "hint" message:@ "This is the use of the warning box above the iOS8.0 version" Preferredstyle:uialertcontrollerstylealert]; Select whether it is alert or sheet through the Preferredstyle parameter.
Uialertaction *sureaction = [uialertaction actionwithtitle:@ "OK" Style:uialertactionstyledefault handler:^ ( Uialertaction *alertaction) {
When the button is clicked, the response is no longer handled by the agent, but by the black body callback
NSLog (@ "OK button is clicked, Test succeeded");
}];
Uialertaction *cancelaction = [uialertaction actionwithtitle:@ "Cancel" Style:uialertactionstylecancel handler:^ ( Uialertaction *alertaction) {
NSLog (@ "Cancel button was clicked, Test succeeded");
}];
[ALERTVC addaction:sureaction];
[ALERTVC addaction:cancelaction];
[Self PRESENTVIEWCONTROLLER:ALERTVC animated:yes completion:^{nslog (@ "jump success");}];
}
Else
{
Uialertview *alert = [[Uialertview alloc]initwithtitle:@] Prompt "message:@" This is the use of the following warning boxes for iOS8.0 versions "delegate:self cancelbuttontitle:@ "Cancel" otherbuttontitles:@ "OK", nil];
[Alert show];
}
#else
{
Uialertview *alert = [[Uialertview alloc]initwithtitle:@] Prompt "message:@" This is the use of the following warning boxes for iOS8.0 versions "delegate:self cancelbuttontitle:@ "Cancel" otherbuttontitles:@ "OK", nil];
[Alert show];
}
#endif
}
About using the prompt box in iOS