//
|
// PBAlertController.m
|
// IphoneBIMe
|
//
|
// Created by zjf on 2018/7/27.
|
// Copyright © 2018年 ProBIM. All rights reserved.
|
//
|
|
#import "PBAlertController.h"
|
|
@interface PBAlertController ()
|
@property (nonatomic, strong) UITapGestureRecognizer *closeGesture;
|
@end
|
|
@implementation PBAlertController
|
|
- (void)viewDidLoad {
|
[super viewDidLoad];
|
self.closeGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(closeAlert:)];
|
}
|
|
- (void)viewDidAppear:(BOOL)animated {
|
[super viewDidAppear:animated];
|
UIView *superView = self.view.superview;
|
if (![superView.gestureRecognizers containsObject:self.closeGesture]) {
|
[superView addGestureRecognizer:self.closeGesture];
|
superView.userInteractionEnabled = YES;
|
}
|
}
|
|
- (void)closeAlert:(UITapGestureRecognizer *) gesture{
|
[self dismissViewControllerAnimated:YES completion:nil];
|
}
|
|
@end
|