ios - New added UITabelView cell is hidden when keyboard is showing in xcode -
currently designed add new line cell in uitableview when user press return button of keyboard. problem after 4 or 5 uitableview cell added, new cell hidden under keyboard. i'm trying solve adjust uitableview when return key pressed failed.
following code.
- (bool)textview:(uitextview *)textview shouldchangetextinrange:(nsrange)range replacementtext:(nsstring *)text{ if ([text isequaltostring:@"\n"]) { coachpaditem *newcoachpaditem = [[coachpaditem alloc]init]; newcoachpaditem.coachpaddescription = @"null"; newcoachpaditem.coachpadtagid = @"0"; [_tagpointsarray addobject:newcoachpaditem]; nsindexpath *indexpath = [nsindexpath indexpathforrow:[_tagpointsarray count]-1 insection:0]; [_coachpadtableview beginupdates]; coachpadpointcell *cell = (coachpadpointcell*)[_coachpadtableview cellforrowatindexpath:0]; [cell.txtpoint becomefirstresponder]; istype = true; if ([isdelete isequaltostring:@"1"]) { isdelete = @"2"; } [_coachpadtableview insertrowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationfade]; [_coachpadtableview endupdates]; return no; } return yes; }
after 4-5 cell added, this:
[uiview beginanimations:nil context:null]; [uiview setanimationdelegate:self]; [uiview setanimationduration:0.3]; [uiview setanimationbeginsfromcurrentstate:yes]; cgrect frame = self.view.frame; frame.origin.y = - 170; self.view.frame = frame; [uiview commitanimations];
after typing finshed, set y again 0
Comments
Post a Comment