1. Alert view generally provides users with alarm information.
For example:
Uialertview * Alert = [[uialertview alloc] initwithtitle: Nil message: @ "the camera cannot use" delegate: Nil cancelbuttontitle: @ "Disable" otherbuttontitles: Nil];
[Alert show];
[Alert release];
2. Action sheet is used to prompt the user to make a choice among several possible operations. It can also be used to give the user a confirmation or cancellation opportunity when the user is about to perform irreversible dangerous operations.
Three steps are required to create an action sheet:
1. Specify that the corresponding viewcontroller complies with the uiactionsheetdelegate protocol.
2. Implement the corresponding delegation Method
3. Create and display the Action sheet as an option for the user, so the number of buttons must be greater than one. In addition, the text displayed on the button should be able to clearly identify the button function.
-(Ibaction) loadactionsheet :( ID) sender
{
Uiactionsheet * actionsheet = [[uiactionsheet alloc] initwithtitle: @ "Action sheet window"
Delegate: Self
Cancelbuttontitle: @ "close"
Destructivebuttontitle: Nil
Otherbuttontitles: @ "show alert window ",
@ "Do something", @ "do something", nil];
[Actionsheet showinview: Self. View];
[Actionsheet release];
}
// Method of the uiactionsheetdelegate Protocol
-(Void) actionsheet :( uiactionsheet *) actionsheet clickedbuttonatindex :( nsinteger) buttonindex
{
Switch (buttonindex)
{
Case 0:
{
Uialertview * Alert = [[uialertview alloc] initwithtitle: @ "alert window"
Message: @ "content btn1"
Delegate: Self
Cancelbuttontitle: @ "OK"
Otherbuttontitles: Nil];
[Alert show];
[Alert release];
}
Break;
Case 1:
{
Uialertview * Alert = [[uialertview alloc] initwithtitle: @ "alert window"
Message: @ "content btn2"
Delegate: Self
Cancelbuttontitle: @ "OK"
Otherbuttontitles: Nil];
[Alert show];
[Alert release];
}
Break;
Case 2:
{
Uialertview * Alert = [[uialertview alloc] initwithtitle: @ "alert window"
Message: @ "content btn3"
Delegate: Self
Cancelbuttontitle: @ "OK"
Otherbuttontitles: Nil];
[Alert show];
[Alert release];
}
Break;
Case 3:
{
Uialertview * Alert = [[uialertview alloc] initwithtitle: @ "Close alert window"
Message: @ "Disable content"
Delegate: Self
Cancelbuttontitle: @ "OK"
Otherbuttontitles: Nil];
[Alert show];
[Alert release];
}
Break;
Default:
Break;
}
}
3. Modal views is a relatively independent user interface. In this interface, you can complete something relatively independent from the software, and then exit modal view to return to the software interface. Typical examples include sending emails in the software and selecting photos from the photo library.
When designing mdal view, pay attention to the following points: first, modal view is generally full screen, and second, modal view should provide a clear button for users to exit modal view. The general practice is to display the navigation bar on it.
[Self presentmodalviewcontroller: picker animated: Yes];
Modal view example reference: http://www.cnblogs.com/hanjun/archive/2012/11/22/2783266.html