Inherits from NSObject
Conforms to UIGestureRecognizerDelegate
Declared in TKAlert.h

Overview

A TKAlert object displays an alert message to the user. It is highly customizable and you can place your own view in it. It supports three predefined show/dismiss animations: scale, slide, fade. You can also dim or blur the background as the TKAlert appears.

Properties

actions

All the actions in TKAlert.

@property (nonatomic, strong, readonly, nonnull) NSArray<__kindofTKAlertAction*> *actions

Declared In

TKAlert.h

actionsLayout

The layout object used to arrange buttons.

@property (nonatomic) TKAlertActionsLayout actionsLayout

Declared In

TKAlert.h

alertView

The view that contains headerView, contentView, buttonsView in itself (read-only).

@property (nonatomic, strong, readonly, nonnull) TKAlertView *alertView

Declared In

TKAlert.h

allowParallaxEffect

Determines if the parallax effect should be applied.

@property (nonatomic) BOOL allowParallaxEffect

Declared In

TKAlert.h

animationDuration

The animation duration of TKAlertAnimation.

@property (nonatomic) CGFloat animationDuration

Declared In

TKAlert.h

attributedMessage

The attributed message used by the custom view.

@property (nonatomic, strong, nullable) NSAttributedString *attributedMessage

Declared In

TKAlert.h

attributedTitle

The attributed title used by the header view.

@property (nonatomic, strong, nullable) NSAttributedString *attributedTitle

Declared In

TKAlert.h

buttonsView

The buttons view (read-only).

@property (nonatomic, strong, readonly, nonnull) TKAlertButtonsView *buttonsView

Declared In

TKAlert.h

contentView

The content view (read-only).

@property (nonatomic, strong, readonly, nonnull) TKAlertContentView *contentView

Declared In

TKAlert.h

customFrame

The custom frame used for TKAlert.

@property (nonatomic) CGRect customFrame

Declared In

TKAlert.h

delegate

TKAlert’s delegate.

@property (nonatomic, weak, nullable) id<TKAlertDelegate> delegate

Declared In

TKAlert.h

dismissMode

Determines the dismiss mode used in TKAlert. - TKAlertDismissModeSwipe - allows user to dismiss the alert by a swipe gesture. - TKAlertDismissModeTap - allows user to dismiss the alert by a tap gesture anywhere on the screen. - TKAlertDismissNone - the user is allowed to dismiss the alert only by tapping one of the actions (buttons).

@property (nonatomic) TKAlertDismissMode dismissMode

Declared In

TKAlert.h

dismissTimeout

This is the amount of time the TKAlert stay on the screen before dismissing itself automatically.

@property (nonatomic) NSTimeInterval dismissTimeout

Declared In

TKAlert.h

headerView

The header view (read-only).

@property (nonatomic, strong, readonly, nonnull) TKAlertContentView *headerView

Declared In

TKAlert.h

message

The message used by the custom view.

@property (nonatomic, strong, nullable) NSString *message

Declared In

TKAlert.h

style

The object responsible for the style of TKAlert.

@property (nonatomic, strong, readonly, nonnull) TKAlertStyle *style

Declared In

TKAlert.h

swipeDismissDirection

Determines if the dismiss direction is vertical or horizontal. This property affects TKAlert only if dismissMode = TKAlertDismissModeSwipe

@property (nonatomic) TKAlertSwipeDismissDirection swipeDismissDirection

Declared In

TKAlert.h

tintColor

The default tint color to be used with TKAlert content.

@property (nonatomic, strong, nullable) UIColor *tintColor

Declared In

TKAlert.h

title

The title used by the header view.

@property (nonatomic, strong, nullable) NSString *title

Declared In

TKAlert.h

visible

Determines if TKAlert’s view is displayed on screen.

@property (nonatomic, getter=isVisible) BOOL visible

Declared In

TKAlert.h

Instance Methods

actionAtIndex:

Returns the action at a given index.

- (TKAlertAction *__nullable)actionAtIndex:(NSInteger)index

Parameters

index

The action index.

Declared In

TKAlert.h

addAction:

This method adds an action to TKAlert.

- (void)addAction:(TKAlertAction *__nonnull)action

Parameters

action

The action to be added.

Declared In

TKAlert.h

addActionWithTitle:handler:

Creates and adds an action to TKAlert.

- (TKAlertAction *__nonnull)addActionWithTitle:(NSString *__nullable)title handler:(BOOL ( ^ __nullable ) ( TKAlert *__nonnull alert , TKAlertAction *__nonnull action ))handler

Parameters

title

The title.

handler

The block that is called after the action is tapped.

Declared In

TKAlert.h

dismiss:

Hides TKAlertView using the chosen dismiss animation.

- (void)dismiss:(BOOL)animated

Parameters

animated

Determines if TKAlert will show with or without an animation.

Declared In

TKAlert.h

initWithTitle:message:delegate:cancelActionTitle:otherActionTitles:

Initializes a TKAlert with a title, a message, a delegate and actions.

- (instancetype __nonnull)initWithTitle:(NSString *__nullable)title message:(NSString *__nullable)message delegate:(id __nullable)delegate cancelActionTitle:(NSString *__nullable)cancelActionTitle otherActionTitles:(id __nullable)title1, ...

Parameters

title

The title.

message

The message.

delegate

The delegate.

cancelActionTitle

The title of the first action.

title1

Titles for the rest of the buttons.

...

Other button titles.

Declared In

TKAlert.h

removeAction:

Removes an action from TKAlert.

- (void)removeAction:(TKAlertAction *__nonnull)action

Parameters

action

The TKAlertAction to be removed.

Declared In

TKAlert.h

removeActionAtIndex:

Removes an action from TKAlert at the given index.

- (void)removeActionAtIndex:(NSInteger)index

Parameters

index

The index of TKAlertAction to be removed.

Declared In

TKAlert.h

shake

Shakes TKAlert.

- (void)shake

Declared In

TKAlert.h

show:

Displays TKAlertView on the screen using the chosen show animation.

- (void)show:(BOOL)animated

Parameters

animated

Determines if TKAlert will show with or without an animation.

Declared In

TKAlert.h