Tyle = "margin-top: 20px; margin-Right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'courier new', console, verdana,; Font: normal 14px/26px Arial ">
Before writingProgramA lot of prompt information is used in the process, so it is very natural to useUialertviewControl. However, the prompt information sometimes only needs to be prompted and does not need to be operated. In this case, the prompt box will disappear automatically.OK.UialertviewAfter2 SThere are two ways to make it disappear automatically:(1)IntegrationNstimer
Define uialertview * basealert;
-(Void) implements mdismiss: (nstimer *) timer {
[Basealert dismisswithclickedbuttonindex: 0 animated: No]; // important
[Basealert release];
Basealert = NULL;
}
-(Void) presentsheet {
Basealert = [[uialertview alloc] initwithtitle: @ "alert" message: @ "\ nmessage message" delegate: Self cancelbuttontitle: Nil otherbuttontitles: Nil];
[Nstimer scheduledtimerwithtimeinterval: 2.0f target: Self selector: @ selector (required mdismiss :) userinfo: Nil repeats: No];
[Basealert show];}
(2)UsePerformselector:Withobject:Afterdelay: Method
-(Void) dimissalert :( uialertview *) Alert {
If (alert ){
[Alert dismisswithclickedbuttonindex: [alert cancelbuttonindex] animated: Yes];
[Alert release];
}
}
-(Void) showalert {
Uialertview * Alert = [[uialertview alloc] initwithtitle: @ "title" message: @ "message" delegate: Nil cancelbuttontitle: nilotherbuttontitles: Nil];
[Alert show];
[Self defined mselector: @ selector (dimissalert :) withobject: Alert afterdelay: 2.0];
}