VSAlertAction

@interface VSAlertAction : UIButton <UIAppearance>

VSAlertAction is a specialized subclass of UIButton that is used to populate and provide interactive controls to an instance of VSAlertController.

  • A factory method to create an instance of UIAlertAction. This is the prefered way to create alert actions.

    Declaration

    Objective-C

    + (nullable instancetype)
    alertActionWithTitle:(nonnull NSString *)title
                   style:(VSAlertActionStyle)style
                  action:(void (^_Nullable)(VSAlertAction *_Nonnull))action;

    Parameters

    title

    The title of the action

    style

    The style of the action

    action

    The block to be executed when the user interacts with the action, but before the alert is dismissed

    Return Value

    The instantiaed action

  • Create an instance of UIAlertAction

    Declaration

    Objective-C

    - (nullable instancetype)
    initWithTitle:(nonnull NSString *)title
            style:(VSAlertActionStyle)style
           action:(void (^_Nullable)(VSAlertAction *_Nonnull))action;

    Parameters

    title

    The title of the action

    style

    The style of the action

    action

    The block to be executed when the user interacts with the action, but before the alert is dismissed

    Return Value

    The instantiaed action

  • The color of the title text used in non-desctructive actions

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nonnull) UIColor *actionTextColor;
  • The color of the title text used in destructive actions

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nonnull)
        UIColor *destructiveActionTextColor;
  • The font of the title used in non-cancel actions

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nonnull) UIFont *actionTextFont;
  • The font of the title used in cancel actions

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nonnull) UIFont *cancelActionTextFont;
  • The title of the alert

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic, nullable) NSString *alertTitle;
  • The display style of the alert

    Declaration

    Objective-C

    @property (readonly, assign, nonatomic) VSAlertActionStyle style;
  • The block that will be executed when the user interacts with the action. The block is called on the main thread always, and begins executed before the alert is dismissed

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic, nullable) void (^)(VSAlertAction *_Nonnull)
        action;