Use of iOS UIAlertView and UIActionSheet

Source: Internet
Author: User

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];

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.