开发者

Scroll UITableViewCell above keyboard for small tableview

开发者 https://www.devze.com 2022-12-31 07:15 出处:网络
I have a tableview which is added to a UIViewController as the tableview only fills the bottom 3/4 of the screen.The rows contain editable UITextFields. When a field is tapped, the keyboard appears bu

I have a tableview which is added to a UIViewController as the tableview only fills the bottom 3/4 of the screen.The rows contain editable UITextFields. When a field is tapped, the keyboard appears but the table does not scroll upwards as would norma开发者_JAVA技巧lly be the case. Consequently, the keyboard obscures the field being edited. I have tried calling

[tableView scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated]

but this has no effect if the table contains only a few rows. How can I get the table to scroll a specific cell above the keyboard? Thank you


MY final workaround is to set the contentoffset of the tableview by the y origin of the cell containing the textfield - 100;

0

精彩评论

暂无评论...
验证码 换一张
取 消