Commit 1e72be780fda0894dbce28d160b0c5fa69be1734
1 parent
adfa1293
0.6.4
Showing
2 changed files
with
22 additions
and
4 deletions
CNLiveCMineModule.podspec
CNLiveCMineModule/Classes/CNCMine/View/CNMineEvaAlertView.m
| ... | ... | @@ -93,9 +93,9 @@ |
| 93 | 93 | } |
| 94 | 94 | + (CNMineEvaAlertView *)setUpFeelBadEvaluateAlertViewDoneBlock:(void (^)(NSString * _Nonnull))doneBlock cancelBlock:(nonnull void (^)(void))cancelBlock{ |
| 95 | 95 | CNMineEvaAlertView *alertView = [CNMineEvaAlertView alertView]; |
| 96 | + __weak typeof(alertView) weakAlert = alertView; | |
| 96 | 97 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { |
| 97 | - alertView.frame = CGRectMake(0, 0,DS_adapt_length(339), DS_adapt_length(567)); | |
| 98 | - [alertView.textView endEditing:YES]; | |
| 98 | + [weakAlert.textView endEditing:YES]; | |
| 99 | 99 | }]; |
| 100 | 100 | [alertView addGestureRecognizer:tap]; |
| 101 | 101 | alertView.frame = CGRectMake(0, 0,kScreenWidth *339/367, kScreenWidth *567/367); |
| ... | ... | @@ -112,6 +112,7 @@ |
| 112 | 112 | __block NSString *swichChooseStr = nil; |
| 113 | 113 | alertView.switchView.chooseBlock = ^(NSString * _Nonnull result) { |
| 114 | 114 | swichChooseStr = result; |
| 115 | + [weakAlert.textView endEditing:YES]; | |
| 115 | 116 | }; |
| 116 | 117 | [alertView.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
| 117 | 118 | make.right.top.equalTo(alertView); |
| ... | ... | @@ -169,7 +170,6 @@ |
| 169 | 170 | modalViewController.contentView = alertView; |
| 170 | 171 | modalViewController.modal = YES; |
| 171 | 172 | [modalViewController showWithAnimated:YES completion:nil]; |
| 172 | - __weak typeof(alertView) weakAlert = alertView; | |
| 173 | 173 | [alertView.closeBtn addBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) { |
| 174 | 174 | [weakModal hideWithAnimated:YES completion:^(BOOL finished) { |
| 175 | 175 | if (cancelBlock) cancelBlock(); |
| ... | ... | @@ -186,6 +186,24 @@ |
| 186 | 186 | }]; |
| 187 | 187 | return alertView; |
| 188 | 188 | } |
| 189 | +- (void)dealloc{ | |
| 190 | + [[NSNotificationCenter defaultCenter] removeObserver:self]; | |
| 191 | + NSLog(@"CNMineEvaAlertView - dealloc"); | |
| 192 | +} | |
| 193 | +- (instancetype)init{ | |
| 194 | + if(self = [super init]){ | |
| 195 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardShowNoti:) name:UIKeyboardWillShowNotification object:Nil]; | |
| 196 | + } | |
| 197 | + return self; | |
| 198 | +} | |
| 199 | +#pragma mark - notification | |
| 200 | +- (void)keyboardShowNoti:(NSNotification *)noti{ | |
| 201 | + NSDictionary *userInfo = noti.userInfo; | |
| 202 | + CGRect keyboardRect = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; | |
| 203 | + CGFloat heyboardHeight = keyboardRect.size.height; | |
| 204 | + self.top -= heyboardHeight; | |
| 205 | +} | |
| 206 | +#pragma mark - Getting | |
| 189 | 207 | - (UIView *)bgView |
| 190 | 208 | { |
| 191 | 209 | if (!_bgView) { | ... | ... |