iOS needs to listen uikeyboardwillchangeframenotifications/uikeyboarddidhidenotifications when dealing with keyboard appearance and disappearance
- (void) viewdidload{[Super Viewdidload];//Add listening keyboard disappears[[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (keyboarddown) Name: UikeyboarddidhidenotificationObject: nil];//Adding a listening keyboard appears[[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (keyboardwillchangeframe:) Name: UikeyboardwillchangeframenotificationObject: nil];}- (void) Keyboardwillchangeframe: (Nsnotification *) noti{//time to remove the keyboard animation (according to UserInfo's Key-uikeyboardanimationdurationuserinfokey)cgfloat Duration=[Noti.userinfo[uikeyboardanimationdurationuserinfokey] floatvalue]; //get the last frame of the keyboard (according to userinfo key----Uikeyboardframeenduserinfokey = "Nsrect: {{0, 227}, {(), 253}}";)CGRect keyboardframe=[Noti.userinfo[uikeyboardframeenduserinfokey] cgrectvalue]; //The processing keyboard appears to be a change in the page ... }- (void) keyboarddown{//handling keyboard disappears is a change in the page ... }
IOS Keyboard monitoring Adjusts the view location