How to use Uialertview and Uiactionsheet (prompting the user)

Source: Internet
Author: User

Uialertview prompt user to help user select box

Uialertview *alterview = [[Uialertview alloc] initwithtitle:@ "Warning" message:@ "You have not finished the information" Delegate:nil CANCELBUTTONTITL e:@ "Cancle" otherbuttontitles:@ "confirmation", nil];

[Alterview show];

[Alterview release];

Alterview *alterview = [[Alterview alloc] initwithtitle:@ "Warning" message:@ "You haven't finished the information yet" delegate:self

cancelbuttontitle:@ "Cancle" otherbuttontitles:@ "confirm", @ "reconfirm", nil];

Alterview.tag=identifier;

[Alterview release];

identifier++;

/**

Title: View Title

Delegate: Setting up the agent

Cancelbuttontitle: The title of the Cancel button

Destructivebuttontitle: Title of the Special tagged button

Otherbuttontitles: Title of other buttons

*/

Uiactionsheet*actionsheet =[[Uiactionsheet Alloc]Initwithtitle:@ " hint " Delegate:self  cancelbuttontitle:@ "Cancel" destructivebuttontitle :@ " title "  //emphasized  < Span class= "S1" >otherbuttontitles:@ " select 1" Span class= "S3", @ " select 2" ,@ " select 3 ",nil];

[Actionsheet showinview:self. Window];

[Actionsheet release];

Introduction of common methods and properties

@property (nonatomic,copy) NSString *title;

Set Title

@property (nonatomic) Uiactionsheetstyle Actionsheetstyle;

To set the style, enumerate the following:

?
123456 typedef  < Code class= "CPP Plain" >ns_enum (nsinteger, uiactionsheetstyle)  {       uiactionsheetstyleautomatic         = -1,             uiactionsheetstyledefault           = uibarstyledefault, &NBSP;&NBSP;&NBSP;&NBSP; Code class= "CPP Plain" >uiactionsheetstyleblacktranslucent = uibarstyleblacktranslucent, &NBSP;&NBSP;&NBSP;&NBSP; uiactionsheetstyleblackopaque       = uibarstyleblackopaque, };

-(Nsinteger) Addbuttonwithtitle: (NSString *) title;

Add a button that returns the index of the button

-(NSString *) Buttontitleatindex: (Nsinteger) Buttonindex;

Get button title

@property (nonatomic,readonly) Nsinteger numberofbuttons;

Get the number of buttons

@property (nonatomic) Nsinteger Cancelbuttonindex;

Set the index value of the Cancel button

@property (nonatomic) Nsinteger Destructivebuttonindex;

Set Special tags

@property (nonatomic,readonly,getter=isvisible) BOOL visible;

Whether the view is currently visible

Here are a few pop-up methods that show different ways depending on style

-(void) Showfromtoolbar: (Uitoolbar *) view;

-(void) Showfromtabbar: (Uitabbar *) view;

-(void) Showfrombarbuttonitem: (Uibarbuttonitem *) Item animated: (BOOL) animated;

-(void) Showfromrect: (cgrect) rect inview: (UIView *) View animated: (BOOL) animated;

-(void) Showinview: (UIView *) view;

-(void) Dismisswithclickedbuttonindex: (Nsinteger) Buttonindex animated: (BOOL) animated;

Use code to retract a view

Three, Uiactionsheet agent method

-(void) Actionsheet: (Uiactionsheet *) Actionsheet Clickedbuttonatindex: (Nsinteger) Buttonindex;

How to trigger when a button is clicked

-(void) Willpresentactionsheet: (Uiactionsheet *) Actionsheet;

The method that fires when the view is about to pop up

-(void) Didpresentactionsheet: (Uiactionsheet *) Actionsheet;

How the view has been triggered by pop-up

-(void) Actionsheet: (Uiactionsheet *) Actionsheet Willdismisswithbuttonindex: (Nsinteger) Buttonindex;

The method that fires when the view is retracted when the button is clicked

-(void) Actionsheet: (Uiactionsheet *) Actionsheet Diddismisswithbuttonindex: (Nsinteger) Buttonindex;

Method triggered when the view has been retracted when the button is clicked

How to use Uialertview and Uiactionsheet (prompting the user)

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.