aboutkeyboardeventviewcontroller.m//querybussinessinfo////Created by Mac on 16/8/23.//copyright©2016 year CQYTJR . All rights reserved.//#import "AboutKeyBoardEventViewController.h" @interface Aboutkeyboardeventviewcontroller () @ End@implementation aboutkeyboardeventviewcontroller-(void) viewdidload {[Super viewdidload]; Self.tableview = [[UITableView alloc]initwithframe:self.view.bounds]; [Self.view AddSubview:self.tableView]; Listen for keyboard popup events [[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (keyboardwillshow:) Name: Uikeyboardwillshownotification Object:nil]; Listen for keyboard hidden events [[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (keyboardwillhide:) Name: Uikeyboardwillhidenotification Object:nil];} -(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (nsinteger) section{return 0;} -(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) indexpath{return nil;} #pragma mark-Keyboard is about to eject event handling-(void) Keyboardwillshow: (nsnotification *) notification{//Get keyboard info nsdictionary *keyboardinfo = [Notifica tion UserInfo]; Get animation time CGFloat duration = [[Keyboardinfo Objectforkey:uikeyboardanimationdurationuserinfokey] floatvalue]; Get the frame information of the keyboard nsvalue *value = [Keyboardinfo Objectforkey:uikeyboardframeenduserinfokey]; Cgsize keyboardsize = [value cgrectvalue].size; [UIView animatewithduration:duration animations:^{//CGRect frame = _chatbar.frame; FRAME.ORIGIN.Y = Screenheight-keyboardsize.height-frame.size.height; _chatbar.frame = frame; CGRect rect = self.tableView.frame; Rect.size.height = Keyboardsize.height; Self.tableView.frame = rect; } Completion:nil];} #pragma mark-The keyboard is about to hide events-(void) Keyboardwillhide: (nsnotification *) notification{//Get keyboard information nsdictionary *keyboardi NFO = [notification UserInfo]; Get animation time CGFloat duration = [[K]Eyboardinfo Objectforkey:uikeyboardanimationdurationuserinfokey] Floatvalue]; Get the frame information for the keyboard [UIView animatewithduration:duration animations:^{cgrect rect = self.tableView.frame ; Rect.size.height = Self.view.bounds.size.height; Self.tableView.frame = rect; } Completion:nil];} -(void) didreceivememorywarning {[Super didreceivememorywarning]; Dispose of any resources the can be recreated.} /* #pragma mark-navigation//in a storyboard-based application, you'll often want to do a little preparation before Nav igation-(void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: (ID) Sender {//Get the new view controller using [SEG UE Destinationviewcontroller]. Pass the selected object to the new view Controller.} */@end
UITableView about keyboard blocking input box workaround