键盘阻止UITableViewCell的UITextField? [英] Keyboard blocking UITableViewCell's UITextField?

查看:115
本文介绍了键盘阻止UITableViewCell的UITextField?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我在每个UITableViewCell中都有一个UITextField,但问题是,如果有2个单元格或更多单元格,则可以切断单元格。

Currently I have a UITextField in each UITableViewCell but the issue is, if there are 2 cells or more the cell could be cut off.

有没有简单的方法键盘打开时,单元格是否可见?

Is there any easy way to make it so that the cell is visible while my keyboard is open?

谢谢!

推荐答案

如果我正确理解你的问题,你希望视图在键盘出现时滚动。
如果你使viewController成为UITableViewController的子类,我相信你可以免费滚动。遗憾的是,唯一的其他选择并非如此简单。您需要使用委派方法来上下移动视图(如果您希望它使用键盘向上滑动,则为其设置动画)。你可以找到很多答案,所以我不会详细介绍,这里有一些帮助你的链接!

If i'm understanding your question correctly, you want the view to scroll when the keyboard shows up. If you make your viewController a subclass of UITableViewController, I believe you get scrolling for free. The only other option is unfortunately not that simple. You need to play around with the delegation methods to move your view up and down (and animate it if you want it to slide up with the keyboard). There's lots of answers to this you can find so I won't go into the details, here's a few links to help you out!

此处深入解释

这里有很好的解释

这里有一些UIScrollView详细信息

更多信息

这篇关于键盘阻止UITableViewCell的UITextField?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆