ios - Problems changing UITableView insets when keyboard its showed -
here deal, have uitableview, , add custom cells different elements uitextfields , others have uitextview. when textfield clicked , keyboard appears, change contentinset of uitableview both, keyboard , textfield visible user.
the problem seems not work when when user click uitextview! try change contentinset nothing happens. here snipped codes.
pd: im doing "register remote not when keyboard appears" thing. not add here.
- (void)keyboardwasshown:(nsnotification*)anotification { nsdictionary* info = [anotification userinfo]; self.keyboardsize = [[info objectforkey:uikeyboardframebeginuserinfokey] cgrectvalue].size; _uploadtableview.contentinset = uiedgeinsetsmake(0, 0, _keyboardsize.height, 0); } - (void)keyboardwillbehidden:(nsnotification*)anotification { _uploadtableview.contentinset = uiedgeinsetsmake(0, 0, 0, 0); }
along changing content insets, need scroll row in uitextview
present.
in keyboardwasshown
_uploadtableview.contentinset = uiedgeinsetsmake(0, 0, _keyboardsize.height, 0); nsindexpath *indexpathofrowcontainingtextview ;//you can indexpath indexpathforcell method of uitableview [_uploadtableview scrolltorowatindexpath:indexpathofrowcontainingtextview atscrollposition:uitableviewscrollpositiontop animated:yes];
in keyboardwillbehidden
_uploadtableview.contentinset = uiedgeinsetsmake(0, 0, 0, 0);
Comments
Post a Comment