Skip to content

Commit fe0d502

Browse files
committed
add alertViewclickedAutoHide
1 parent 443b2b7 commit fe0d502

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

TYAlertControllerDemo/TYAlertController/TYAlertView.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ typedef NS_ENUM(NSUInteger, TYAlertActionStyle) {
6363
@property (nonatomic, assign) CGFloat textFieldBorderWidth;
6464
@property (nonatomic, assign) CGFloat textFieldContentViewEdge;
6565

66+
@property (nonatomic, assign) BOOL clickedAutoHide;
67+
6668

6769
+ (instancetype)alertViewWithTitle:(NSString *)title message:(NSString *)message;
6870

TYAlertControllerDemo/TYAlertController/TYAlertView.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ + (instancetype)alertViewWithTitle:(NSString *)title message:(NSString *)message
120120

121121
- (void)configureProperty
122122
{
123+
_clickedAutoHide = YES;
123124
self.backgroundColor = [UIColor whiteColor];
124125
_alertViewWidth = kAlertViewWidth;
125126
_contentViewSpace = kContentViewSpace;
@@ -387,7 +388,9 @@ - (void)actionButtonClicked:(UIButton *)button
387388
{
388389
TYAlertAction *action = _actions[button.tag - kButtonTagOffset];
389390

390-
[self hideView];
391+
if (_clickedAutoHide) {
392+
[self hideView];
393+
}
391394

392395
if (action.handler) {
393396
action.handler(action);

0 commit comments

Comments
 (0)