iPhone - Keyboard hides TextField(iPhone - 键盘隐藏文本字段)
问题描述
我正在使用 UITextField 接收用户输入.但是,由于我的文本字段朝向笔尖的中间/底部,因此当键盘弹出时它会被隐藏.有什么方法可以将它与键盘一起滑动,以便在选择过程中它位于键盘的顶部?另外,由于我也在使用数字键盘,有没有一种简单的方法可以在某处包含完成按钮?
I am using UITextField to receive user inputs. However, since my textfields are towards the middle/bottom of the nib, it gets hidden when the keyboard pops up. Is there any way sort of slide it along with the keyboard so that it's on the top of the keyboard during selection? Also, since I am also using the numberpad, is there an easy way to include a done button somewhere?
感谢您的帮助.
推荐答案
键盘出现时滚动,我喜欢本教程来自 Cocoa With Love.
To scroll when the keyboard appears, I like this tutorial from Cocoa With Love.
要关闭数字键盘,您可以 在键盘上放置一个自定义的完成"按钮或在屏幕的其余部分制作一个不可见的按钮.我已经用代码完成了后者,但是 本教程 使用界面生成器.
To dismiss the number keypad, you can put a custom "Done" button on the keypad or make an invisible button over the rest of the screen. I have done the latter with code, but this tutorial uses Interface Builder.
这篇关于iPhone - 键盘隐藏文本字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iPhone - 键盘隐藏文本字段


- Android viewpager检测滑动超出范围 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01