Set up a broadcast in the notification center to listen for pop-up and bounce of the keyboard, and to include actions to trigger events in the listener event.
Object : nil]; object: nil];
Some notifications for listening to the keyboard:
// Span style= "color: #008000;" >// uikeyboardwillchangeframenotification // uikeyboarddidchangeframenotification notifications issued when keyboard is displayed // uikeyboardwillshownotification // Uik Eyboarddidshownotification // Notification issued when the keyboard is hidden // Uikeyboardwillhidenotification // Uikeyboarddidhidenotification
The effect I need to implement here (e.g.) is to move the lower toolbar up to the appropriate position when the keyboard pops up, so you need to know the height of the keyboard and the time to pop the animation, and broadcast listening to get the keyboard frame and pop-up animation time:
NSString *duration = Userinfo[uikeyboardanimationdurationuserinfokey]; = [Userinfo[uikeyboardframeenduserinfokey] cgrectvalue];
The animation effect changes the frame of TableView and toolbar so that the keyboard will not be obscured when it pops up:
[UIView animatewithduration:[duration Doublevalue] Delay:0.0Options:uiviewanimationoptioncurvelinear animations:^{_tableview.frame= CGRectMake (0, -, Size.width, Size.Height- --KeyboardFrame.size.height- -); Footview.frame= CGRectMake (0, Size.height-keyboardframe.size.height- -, Size.width, -); } Completion:^(BOOL finished) {Nsindexpath*path = [Nsindexpath indexpathforrow:_dataarray.count-1Insection:0]; [_tableview Scrolltorowatindexpath:path Atscrollposition:uitableviewscrollpositionbottom Animated:YES]; }];
:
Kvo to monitor keyboard pop-up and bounce back