Warning Box (Alertview) When modal, do not close it can not do other things, so not the following circumstances should not be used casually.
1, the application cannot continue to execute.
If there is not enough memory, there is no network. Generally, only a button is required.
2, there is a solution to the question.
When unable to execute, ask if you can get enough 3G network.
3. Ask for authorization for the operation.
When it comes to access to private information, user authorization, such as location, Sang, etc. is required.
The action table (Actionsheet) provides multiple choices to the user. can use it to send a picture to a Sina Weibo or Facebook platform.
/implement uialertviewdelegate//This trust is actually not practical, just practice practiced hand, because the warning form has two buttons indexed//No for 0,yes (void) Alertview: (Uialertview *) Alertview Clickedbuttonatindex: (Nsinteger) buttonindex{NSLog (@ "Buttonindex =%li", (long) buttonindex);} Implementing uiactionsheetdelegate//This commitment also has no practical significance, that is, in the output command form output pressed index number to achieve response-(void) Actionsheet: (Uiactionsheet *) Actionsheet Clickedbuttonatindex: (Nsinteger) buttonindex{NSLog (@ "Buttonindex =%li", (long) buttonindex);} -(Ibaction) Testalertview: (ID) Sender {//warning box is described above//delegate the parameter used to set the warning form's entrusted object Uialertview *alertview = [[Uiale Rtview alloc] initwithtitle:@ "alert" message: @ "Alert text goes Here" Delegate:self cancelbuttontitle:@ "No" otherbuttontitles:@ "Yes", nil]; [Alertview show]; }-(ibaction) Testactionsheet: (ID) Sender {//Cancelbuttontitle set Cancel title//Destructivebuttontile Set the Broken button, only one can be on top UiacTionsheet *actionsheet = [[Uiactionsheet alloc] Initwithtitle:nil Delegate:self cancelbuttontitle:@ "Cancel" destructivebuttontitle:@ "destructive button" otherbuttontitles:@ "Sina Weibo", Nil]; Set to own active style Actionsheet.actionsheetstyle = uiactionsheetstyleautomatic; [Actionsheet ShowInView:self.view];}
Warning boxes and action sheets (iOS development)