UIAlertView is similar to MessageBox on Windows. A small record, ah! I want to write down everything that I want to write down, even though it is simple and the related technical documents of Apple are also described. The initial stages of obsessive-compulsive disorder show up ....
Code:
General Usage
UIAlertView *alert =[[UIAlertView alloc] initWithTitle:@"hello" message:@"I'm Apple" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];[alert show];[alert release];
When there are multiple buttons
UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @ "hello" message: @ "O ha" delegate: self cancelButtonTitle: @ "OK" otherButtonTitles: @ "cancel ", @ "Ignore", nil];
In UIAlertViewDelegate
-(Void) alertView :( UIAlertView *) alertview
ClickedButtonAtIndex :( NSInteger) buttonIndex
You can see the button you clicked.
UIActionSheet is a modal dialog box popped up from the bottom of the screen. Its usage is also very simple.
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure?" delegate:self cancelButtonTitle:@"No Way!" destructiveButtonTitle:@"Yes, I'm sure!" otherButtonTitles:nil]; [actionSheet showInView:self.view];