All Products
Search
Document Center

Mobile Platform as a Service:Button base class

Last Updated:Jul 17, 2023

AUButton follows the new UED requirements, currently contains two styles, and cannot be fully interconnected with APButton in APCommonUI. These two styles do not include the operation button of the warning type.

Dependency

The dependency of AUButton is as follows:

import <UIKit/UIKit.h>

API description

/**
     Initialization method
     @param style The style.
     @return The created initialization object.
     */
    + (instancetype)buttonWithStyle:(AUButtonStyle)style;

    /**
     * An auxiliary method of the initialization, used for creating and initializing a button object.
     *
     * @param buttonType    The button type. It must be one of the values defined in AUButtonStyle.
     *  @param title        Button title.
     *  @param target       The object responding to the button tap event.
     *  @param action       The function responding to the button tap event.
     *
     * @return The button object newly created and initialized.
     *
     * The initialization object of this method. A frame needs to be set.
     */
    + (instancetype)buttonWithStyle:(AUButtonStyle)style title:(NSString *)title target:(id)target action:(SEL)action;

    /**
     Display the loading icon animation and text (the loading icon is on the left and the text is on the right). When there is no text, the loading icon is centered.

     @param loadingTitle    The text to be displayed along with the loading icon. If this parameter is set to nil or an empty string, text is not displayed and the loading icon is centered.
     @param currentVC       The current VC that is used to remove the mask after the loading is complete.
     */
    - (void)startLoadingWithTitle:(NSString *)loadingTitle currentViewController:(UIViewController *)currentVC;


    /**
     Stop the rotation of the loading icon.
     */
    - (void)stopLoading;

Custom properties

Property

Description

AUButtonStyleNone

The default style.

AUButtonStyle1

Blue background, white text, borderless, and large button.

AUButtonStyle2

White background, black text, light gray border, and large button.

AUButtonStyle3

Transparent background, blue text, blue border, and small button.

AUButtonStyle4

White background, with upper and lower separation lines by default, and red text; applicable to page bottom operation scenarios (unfollow); default height: 44 units; width: same as screen width.

AUButtonStyle5

White background, with upper and lower separation lines by default, and ant blue text; applicable to page bottom operation scenarios (more services); default height: 44 units, and width: same as screen width

AUButtonStyle6

Red background, white text, for operations of the warning type, and large button.

AUButtonStyle7

White background, black text, light gray border, and small button.

AUButtonStyle8

Blue background, white text, borderless, and small button.

Code sample

AUButton *button = [AUButton buttonWithStyle:AUButtonStyle2     title:@"AUButtonStyle2" target:self action:@selector(onButtonClicked:)];
   button.frame = CGRectMake(XX, XX,XX, XX);

    AUButton *buttonDisable = [AUButton buttonWithStyle:AUButtonStyle1];
   buttonDisable.enabled = NO;
   [buttonDisable setTitle:@"Style1disable" forState:UIControlStateNormal];
   buttonDisable.frame = CGRectMake(XX, XX,XX, XX);

    //Set the loading icon on the button.
    [button startLoadingWithTitle:@"Loading" currentViewController:self];

    //Stop the rotation of the loading icon on the button.
    [button stopLoading];