The Uitableviewcontroller itself enables keyboard adaptation (the control focus in the cell is moved above the keyboard
Think about the following when you do a keyboard retraction
1. TableView Add Click event
Result: Click events and TableView didselect conflict, resulting in didselect failure
2, ScrollView agent scroll back keyboard
Results: The goal can be achieved, but when the click TextField, the keyboard will appear after the direct recovery. The reason is that the first adaptation → Call ScrollView proxy.
Finally, the following scenario is used
<span style= "font-family:arial, Helvetica, Sans-serif;" >_SUREBTN = [UIButton buttonwithtype:uibuttontypecustom];</span> _surebtn.frame = CGRectMake ( SELF.VIEW.SIZE.WIDTH-60, 5, (); _surebtn.backgroundcolor = [Uicolor colorwithred:0.150 green:0.662 blue:0.915 alpha:1.000]; _surebtn.titlelabel.font = [Uifont systemfontofsize:15]; _surebtn.layer.cornerradius = 5.0; [_surebtn settitle:@ "OK" forstate:uicontrolstatenormal]; [_surebtn addtarget:self Action: @selector (Changeremarks) forcontrolevents:uicontroleventtouchupinside]; _view=[[uiview Alloc] Initwithframe:cgrectmake (0, 0, self.view.frame.size.width, +)]; _view.backgroundcolor=[uicolor Whitecolor]; UIView *line = [[UIView alloc] Initwithframe:cgrectmake (0, 0, Self.view.frame.size.width, 0.5)]; Line.backgroundcolor = [Uicolor blackcolor]; [_view Addsubview:line]; [_view ADDSUBVIEW:_SUREBTN];
When used, the following treatment is textfield into the
_begoodatfield.inputaccessoryview = _view;
If it's a text box in cell TableView
You need to define a temporary textfield.
When using the
_xuexiaofield=cellmenu.celltext; _xuexiaofield.inputaccessoryview = _view;//<span style= "font-family:arial, Helvetica, Sans-serif;" >cellmenu the name of the custom cell </span>
Attach the OK button method
-(void) changeremarks{ [_nicktextfield Resignfirstresponder]; [_xuexiaofield Resignfirstresponder]; [_begoodatfield Resignfirstresponder]; [_bumenfield Resignfirstresponder];}
Https://github.com/KKKKaras/SureBtnDemo
[IOS] Uitableviewcontroller Complete Retract keyboard operation