@@ -45,31 +45,39 @@ - (void)addNotification{
4545#pragma mark -- 监听键盘
4646- (void )clickKeyBoardChange : (NSNotification *)noti {
4747 NSDictionary *userInfo = noti.userInfo ;
48- NSLog (@" clickKeyBoardChange:%@ " ,userInfo);
48+ // NSLog(@"clickKeyBoardChange:%@",userInfo);
4949 CGRect endFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue ];
50- self.height = screenH - endFrame.origin .y +self.inputViewHeight ;
51- if (!self.onShowKeyboard ) { return ; }
52- // [UIView animateWithDuration:0.5 animations:<#^(void)animations#>]
50+ // self.height = screenH - endFrame.origin.y+self.inputViewHeight;
51+ NSLog (@" ----height:%f " ,self.height );
52+ CGFloat tmpH = screenH - endFrame.origin .y +self.inputViewHeight ;
53+ CGFloat keyboardY = screenH - 20 ;
54+ if (!(self.showExpressionBtn .selected || self.showMenuBtn .selected ) || (keyboardY > endFrame.origin .y )) {
55+ if (!self.onShowKeyboard ) { return ; }
56+ self.onShowKeyboard (@{@" inputHeight" :@(tmpH),@" showType" :@(0 )});
57+ }
58+ // [[NSNotificationCenter defaultCenter]postNotificationName:@"ChangeMessageListHeightNotification" object:@{@"listViewHeight":@(screenH - 60 - tmpH)}];
5359
54- self.onShowKeyboard (@{@" inputHeight" :@(self.height ),@" showType" :@(0 )});
55- [[NSNotificationCenter defaultCenter ]postNotificationName:@" ChangeMessageListHeightNotification" object: @{@" listViewHeight" :@(screenH - 60 - self.height )}];
5660
5761}
5862
5963- (void )hidenFeatureView {
6064 __weak typeof (self)weakSelf = self;
6165 dispatch_sync (dispatch_get_main_queue (), ^{
6266 [weakSelf.inputGrowView endEditing: YES ];
63- weakSelf.expressionView .hidden = YES ;
64- if (weakSelf.showMenuBtn .selected && (weakSelf.height > self.menuViewH )) {
65- weakSelf.showMenuBtn .selected = NO ;
66- weakSelf.height = weakSelf.height - self.menuViewH ;
67- weakSelf.onFeatureView (@{@" inputHeight" :@(weakSelf.height ),@" showType" :@(0 )});
68- }else if (weakSelf.showExpressionBtn .selected && (weakSelf.height > expressionViewH )){
69- weakSelf.showExpressionBtn .selected = NO ;
70- weakSelf.height = weakSelf.height - expressionViewH;
71- weakSelf.onFeatureView (@{@" inputHeight" :@(weakSelf.height ),@" showType" :@(0 )});
72- }
67+ [UIView animateWithDuration: 1.0 animations: ^{
68+ if (weakSelf.showMenuBtn .selected && (weakSelf.height > self.menuViewH )) {
69+ weakSelf.showMenuBtn .selected = NO ;
70+ weakSelf.height = weakSelf.height - self.menuViewH ;
71+ weakSelf.onFeatureView (@{@" inputHeight" :@(weakSelf.height ),@" showType" :@(0 )});
72+ }else if (weakSelf.showExpressionBtn .selected && (weakSelf.height > expressionViewH )){
73+ weakSelf.showExpressionBtn .selected = NO ;
74+ weakSelf.height = weakSelf.height - expressionViewH;
75+ weakSelf.onFeatureView (@{@" inputHeight" :@(weakSelf.height ),@" showType" :@(0 )});
76+ }
77+ } completion: ^(BOOL finished) {
78+ weakSelf.expressionView .hidden = YES ;
79+ }];
80+
7381 });
7482
7583}
0 commit comments