Uiactionsheet use in iOS

Source: Internet
Author: User

How to use Uiactionsheet in iOS
First, the method of initialization

-(instancetype) Initwithtitle: (nsstring *) title delegate: (ID< Uiactionsheetdelegate>) Delegate cancelbuttontitle: (nsstring *) cancelbuttontitle Destructivebuttontitle: (nsstring *) destructivebuttontitle otherbuttontitles: (nsstring *) Otherbuttontitles, ...;


Parameter description:

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

Introduction of common methods and properties

@property(nonatomic,copy) nsstring *title;

Set Title

@property (nonatomic) Uiactionsheetstyle Actionsheetstyle;

To set the style, enumerate the following:

typedef ns_enum (Nsinteger, uiactionsheetstyle) {uiactionsheetstyleautomatic =-1, Uiactionsheetstylede Fault = uibarstyledefault, uiactionsheetstyleblacktranslucent = uibarstyleblacktranslucent, UIActionSheetSt Yleblackopaque = 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

Uiactionsheet use in iOS

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.