The core code for the iOS8 numeric keypad plus the bottom left corner of the button is as follows:
-(void) adddonebuttontonumpadkeyboard{UIButton *donebutton = [UIButton buttonwithtype:uibuttontypecustom]; if (Systemversion < 8.0) {donebutton.frame = CGRectMake (0, 163, 106, 53); }else{donebutton.frame = CGRectMake (0, screen_size.height-53, 106, 53); } Donebutton.tag = Num_pad_done_button_tag; donebutton.adjustsimagewhenhighlighted = NO; [Donebutton settitle:@ "finished" forstate:uicontrolstatenormal]; [Donebutton Settitlecolor:[uicolor Blackcolor] forstate:uicontrolstatenormal]; [Donebutton addtarget:self Action: @selector (Donebutton:) forcontrolevents:uicontroleventtouchupinside]; Nsarray *windowarr = [[UIApplication sharedapplication] windows]; if (Windowarr! = Nil && windowarr.count > 1) {UIWindow *needwindow = [Windowarr objectatindex:1]; UIView *keyboard; for (int i = 0; i < [needwindow.subviews count]; i++) {keyboard = [needwindow.subviews objectatindex:i]; NSLog (@ "%@", [KeYboard description]); if ([[[Keyboard description] hasprefix:@ "<uiperipheralhostview"] = = YES) | | ([[Keyboard description] hasprefix:@ "<uikeyboard"] = = YES) | | ([[[Keyboard description] hasprefix:@ "<uiinputsetcontainerview"] = = YES)) {UIView *donebuttonview = [keyboard Viewwithtag:num_pad_done_button_tag]; if (Donebuttonview = = nil) {[Keyboard Addsubview:donebutton]; }}}}}-(void) removedonebuttonfromnumpadkeyboard{UIView *donebutton = nil; Nsarray *windowarr = [[UIApplication sharedapplication] windows]; if (Windowarr! = Nil && windowarr.count > 1) {UIWindow *needwindow = [Windowarr objectatindex:1]; UIView *keyboard; for (int i = 0; i < [needwindow.subviews count]; i++) {keyboard = [needwindow.subviews objectatindex:i]; if ([[[Keyboard description] hasprefix:@ "<uiperipheralhostview"] = = YES) | | ([[Keyboard description] hasprefix:@ "<uikeyboard"] = = YES) | | ([[[Keyboard description] hasprefix:@ "<uiinputsetcontainerview"] = = YES)) {Donebutton = [keyboard Viewwithtag:num_pad_done_button_tag]; if (Donebutton! = nil) {[Donebutton Removefromsuperview]; } } } }}
Note:
After 1.ios8, the description of the keyboard view changes to start with <uiinputsetcontainerview , so you need to add this to the inferred logic.
After 2.ios8. The size of the keyboard view becomes the size of the entire screen. So you need to adapt the location of the button.
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
IOS8 numeric keypad plus left lower corner to complete button