Inherits from UIView
Declared in DTAlertView.h
DTAlertView.m

Overview

Custom alert view solved the ios UIAlertView can’t addSubview problem at iOS7.

Properties

alertViewMode

The alert mode display to th user.

@property (nonatomic, assign) DTAlertViewMode alertViewMode

Discussion

Default is DTAlertViewModeNormal.

See Also

Declared In

DTAlertView.h

backgroundView

The background view display in alert view.

@property (nonatomic, retain) UIView *backgroundView

Discussion

Default is nil.

Declared In

DTAlertView.h

cancelButtonIndex

The button index of cancel button.

@property (nonatomic, readonly) NSInteger cancelButtonIndex

Discussion

Default is -1 if cancelButtonTitle not set or 0.

Declared In

DTAlertView.h

clickedButtonTitle

The button title of clicked button.

@property (nonatomic, readonly) NSString *clickedButtonTitle

Discussion

Defalt is nil, when alert view clicked, value is the clicked button title.

Declared In

DTAlertView.h

cornerRadius

The corner radius dispaly in alert view background.

@property (assign) CGFloat cornerRadius

Discussion

Defauls value 0.0, when shown is 25.0 if value not changed.

Declared In

DTAlertView.h

delegate

The DTAlertView delegate.

@property (nonatomic, assign) id<DTAlertViewDelegate> delegate

Discussion

The receiver’s delegate, If DTAlertViewButtonClickedBlock is setted, it will ignore the receiver value.

Declared In

DTAlertView.h

dismissAnimationWhenButtonClicked

The dismiss animetion, when button clicked.

@property (nonatomic, assign) DTAlertViewAnimation dismissAnimationWhenButtonClicked

Discussion

Default is DTAlertViewAnimationDefault.

Declared In

DTAlertView.h

message

The alert view message, descriptive text more datails than title.

@property (nonatomic, retain) NSString *message

Declared In

DTAlertView.h

progressBarColor

Set all of UIProgressView progress bar tint color.

@property (nonatomic, retain) UIColor *progressBarColor

Discussion

Default is nil.
Only can be set it when DTAlertViewMode is DTAlertViewModeProgress and DTAlertViewModeDuoProgress.

Declared In

DTAlertView.h

textField

The UITextField appears DTAlertViewModeTextInput.

@property (nonatomic, readonly) UITextField *textField

Discussion

Default is nil on not shown. inital it at shown.
Only can get it when DTAlertViewMode is DTAlertViewModeTextInput.

Declared In

DTAlertView.h

title

The alert view title. appears in the title bar.

@property (nonatomic, retain) NSString *title

Declared In

DTAlertView.h

visible

Check alert view is visible.

@property (nonatomic, readonly, getter=isVisible) BOOL visible

Declared In

DTAlertView.h

Class Methods

alertViewUseBlock:title:message:cancelButtonTitle:positiveButtonTitle:

Initial for class method with block.

+ (DTInstancetype)alertViewUseBlock:(DTAlertViewButtonClickedBlock)block title:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle positiveButtonTitle:(NSString *)positiveButtonTitle

Parameters

block

The DTAlertViewButtonClickedBlock block.

title

The alert view title. appears in the title bar.

message

The alert view message, descriptive text more datails than title.

cancelButtonTitle

The title of cancel button or nil if there is no cancel button.

positiveButtonTitle

The title of positive button or nil if there is no positive button.

Return Value

Newly initialized alert view.

Declared In

DTAlertView.h

alertViewWithTitle:message:delegate:cancelButtonTitle:positiveButtonTitle:

Initial for class method with delegate.

+ (DTInstancetype)alertViewWithTitle:(NSString *)title message:(NSString *)message delegate:(id<DTAlertViewDelegate>)delegate cancelButtonTitle:(NSString *)cancelButtonTitle positiveButtonTitle:(NSString *)positiveButtonTitle

Parameters

title

The alert view title. appears in the title bar.

message

The alert view message, descriptive text more datails than title.

delegate

The receiver’s delegate or nil if it doesn’t have a delegate.

cancelButtonTitle

The title of cancel button or nil if there is no cancel button.

positiveButtonTitle

The title of positive button or nil if there is no positive button.

Return Value

Newly initialized alert view.

Declared In

DTAlertView.h

dismissAlertViewViaMessage:

Hide filtered alert view via correspond the message .

+ (BOOL)dismissAlertViewViaMessage:(NSString *)message

Parameters

message

The message to filter all of shown alert views.

Return Value

If Yes is succed hide all alert view, No is failed hide alert view or no alert view correspond the receive message.

Declared In

DTAlertView.h

dismissAlertViewViaTitle:

Hide filtered alert view via correspond the title.

+ (BOOL)dismissAlertViewViaTitle:(NSString *)title

Parameters

title

The title to filter all of shown alert views.

Return Value

If Yes is succed hide all alert view, No is failed hide alert view or no alert view correspond the receive title.

See Also

Declared In

DTAlertView.h

dismissAllAlertView

Hide all alert.

+ (BOOL)dismissAllAlertView

Return Value

If Yes is succed hide all alert view, No is failed hide alert view or no alert view is shown.

Declared In

DTAlertView.h

Instance Methods

dismiss

Hide alert with default animation.

- (void)dismiss

Declared In

DTAlertView.h

dismissWithAnimation:

Hide alert with receiver animation.

- (void)dismissWithAnimation:(DTAlertViewAnimation)animation

Parameters

animation

A constant to define what animation will dismiss alert view.

Discussion

See the descriptions of the constants of the DTAlertViewAnimation type for more information.

Declared In

DTAlertView.h

initWithBlock:title:message:cancelButtonTitle:positiveButtonTitle:

Initial method with block.

- (DTInstancetype)initWithBlock:(DTAlertViewButtonClickedBlock)block title:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle positiveButtonTitle:(NSString *)positiveButtonTitle

Parameters

block

The DTAlertViewButtonClickedBlock block.

title

The alert view title. appears in the title bar.

message

The alert view message, descriptive text more datails than title.

cancelButtonTitle

The title of cancel button or nil if there is no cancel button.

positiveButtonTitle

The title of positive button or nil if there is no positive button.

Return Value

Newly initialized alert view.

Declared In

DTAlertView.h

initWithTitle:message:delegate:cancelButtonTitle:positiveButtonTitle:

Initial method with delegate.

- (DTInstancetype)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id<DTAlertViewDelegate>)delegate cancelButtonTitle:(NSString *)cancelButtonTitle positiveButtonTitle:(NSString *)positiveButtonTitle

Parameters

title

The alert view title. appears in the title bar.

message

The alert view message, descriptive text more datails than title.

delegate

The receiver’s delegate or nil if it doesn’t have a delegate.

cancelButtonTitle

The title of cancel button or nil if there is no cancel button.

positiveButtonTitle

The title of positive button or nil if there is no positive button.

Return Value

Newly initialized alert view.

Declared In

DTAlertView.h

setBlurBackgroundWithColor:alpha:

Set iOS7 style blur background color

- (void)setBlurBackgroundWithColor:(UIColor *)color alpha:(CGFloat)alpha

Parameters

color

The color of blur display color.

alpha

The opacity value of the color object, specified as a value from 0.0 to 1.0.

Discussion

Warning: This method only available iOS7.

Declared In

DTAlertView.h

setPercentage:

Adjust the current percentage at DTAlertViewModeNormal and DTAlertViewModeDuoProgress mode.
Percentage show under porgress view at DTAlertViewModeNormal or under second (bottom) progress view at DTAlertViewModeDuoProgress.
Progress view’s (upper this percentage) progress will adjust by this receiver.

- (void)setPercentage:(CGFloat)percentage

Parameters

percentage

This value represented a floating-point value between 0.0 and 1.0, inclusive,
where 1.0 indicates the completion of the task. The default value is 0.0.
Values less than 0.0 and greater than 1.0 are pinned to those limits.

Declared In

DTAlertView.h

setPositiveButtonEnable:

Set positive button enable or disable.

- (void)setPositiveButtonEnable:(BOOL)enable

Parameters

enable

If NO the positive button will disable.

Discussion

Default is Enable.

Declared In

DTAlertView.h

setProgressStatus:

Adjust the current progress status at DTAlertViewModeDuoProgress mode,
first (top) progress view’s progress will adjust by this receiver at DTAlertViewModeDuoProgress mode.

- (void)setProgressStatus:(DTProgressStatus)status

Parameters

status

The current status of the receiver.

Declared In

DTAlertView.h

setTextFieldDidChangeBlock:

Set block to notify when text in textField is changed.

- (void)setTextFieldDidChangeBlock:(DTAlertViewTextDidChangeBlock)textBlock

Parameters

textBlock

A block containing the changes textFidle text did change. This is where you programmatically change setPositiveButtonEnable enable or disable and other.

Discussion

The method performs textField text change.
For example, if you want disable positive button on less 10 characters, edable on great 10 characters.

[alertView setTextFieldDidChangeBlock:^(DTAlertView _alertView, NSString text){
	[_alertView setPositiveButtonEnable:(text.length > 10)];
}];

Declared In

DTAlertView.h

shakeAlertView

The shake animation, appearance like password error animation on OS X.

- (void)shakeAlertView

Declared In

DTAlertView.h

show

Shows popup alert with default animation.

- (void)show

Declared In

DTAlertView.h

showForPasswordInputWithAnimation:

Shows popup alert for input pasword with receiver animation and would not dissmiss when click button.
Want to dismiss this alert to use dismiss or dismissWithAnimation: .

- (void)showForPasswordInputWithAnimation:(DTAlertViewAnimation)animation

Parameters

animation

A constant to define what animation will show alert view.

Discussion

See the descriptions of the constants of the DTAlertViewAnimation type for more information.

Declared In

DTAlertView.h

showWithAnimation:

Shows popup alert with receiver animation.

- (void)showWithAnimation:(DTAlertViewAnimation)animation

Parameters

animation

A constant to define what animation will show alert view.

Discussion

See the descriptions of the constants of the DTAlertViewAnimation type for more information.

Declared In

DTAlertView.h