IOS8 after the Apple can install a third-party keyboard,
By breakpoints we will find that after using a third-party keyboard,
The keyboard will pop up method:-(void) Keyboardwillshow: (nsnotification *) notification will execute three times,
The height of the three times is: 0:216:282. We find that what we need is the height of the third time.
We need to register the keyboard to hide and display the notifications:
[[Nsnotificationcenter defaultcenter]addobserver:self selector: @selector (keyboarddidhide:) Name: Uikeyboardwillhidenotification Object:nil];
[[Nsnotificationcenter defaultcenter]addobserver:self selector: @selector (keyboardwillshow:) Name: Uikeyboardwillshownotification Object:nil];
1 #pragmamark– Keyboard Display Events2 3- (void) Keyboardwillshow: (Nsnotification *) Notification {4CGFloat curkeyboardheight = [[[Notification UserInfo] Objectforkey:@"Uikeyboardboundsuserinfokey"] Cgrectvalue].size.height;5CGRect begin = [[[Notification UserInfo] Objectforkey:@"Uikeyboardframebeginuserinfokey"] Cgrectvalue];6CGRect end = [[[Notification UserInfo] Objectforkey:@"Uikeyboardframeenduserinfokey"] Cgrectvalue];7 8 //third-party keyboard callback three issues, listening only to perform the last9 if(begin.size.height>0&& (begin.origin.y-end.origin.y>0)){Ten OneCGFloat keyboardheight =Curkeyboardheight; A -NSLog (@"third time:%f", keyboardheight); -[UIView animatewithduration:0.05animations:^{ theSelf.bgView.hidden =NO; -SELF.COMMENTTOOLVIEW.Y = Kscreenheight-keyboardheight- -; - - }]; + } - } + A #pragmamark– keyboard-Hidden events at --(void) Keyboarddidhide: (Nsnotification *) notification{ -NSLog (@"Keyboard Hide"); -Self.bgView.hidden =YES; -SELF.COMMENTTOOLVIEW.Y =Kscreenheight; -}
IOS8 after the third-party keyboard gets the wrong height