How to scroll the UITableviewcell scroll up when the keyboard appears? [duplicate]

断了今生、忘了曾经 提交于 2019-12-04 06:46:19
Mitesh Khatri

Please try below code in -textFieldShouldBeginEditing ....

self.tblView.frame= CGRectMake(self.tblView.frame.origin.x, self.tblView.frame.origin.y, self.tblView.frame.size.width, self.tblView.frame.size.height - 190);
NSIndexPath *indexPath =[NSIndexPath indexPathForRow:nIndex inSection:nSectionIndex];
[self.tblView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];

Thanks

You can use the sample code to take some hint.

https://github.com/michaeltyson/TPKeyboardAvoiding

I have used it in my projects as well.Hope it helps

Check out the below link from apple documentation with complete explanation and required code

They have talked about for registering for the keyboard appear and disappear notification and alter the rect of your underlaying UIView in the notification method for more go through the below URL.

Moving Content That Is Located Under the Keyboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!