在工具栏上方显示键盘?

发布于 2024-10-19 09:06:43 字数 357 浏览 3 评论 0原文

我有一个带有单个文本字段的 iPad 应用程序。当用户单击文本字段时,我希望键盘出现,而不移动或覆盖屏幕底部的工具栏。我最接近的情况如下:

[textField setInputAccessoryView:toolBar];

这有两个问题。

  1. 当工具栏出现时,键盘会将其向上推。
  2. 当键盘关闭时,工具栏也会随之消失!

如果我能解决 2,那么我可能可以接受 1,但我宁愿找到两者的解决方案。谢谢!

编辑:我放弃根据 TomSwift 的答案修复 1,但是有人可以告诉我是否有办法在键盘出现时推起工具栏,然后在键盘消失时将工具栏放回原位???谢谢!

I have an ipad app with a single textfield. When the user clicks in the textfield, I want the keyboard to come up without moving or covering the toolbar at the bottom of the screen. The closest I've come to this is the following:

[textField setInputAccessoryView:toolBar];

There are two problems with this.

  1. The keyboard pushes the toolbar up when it appears.
  2. When the keyboard is dismissed, it takes the toolbar with it!

If I could fix 2, then I could probably live with 1, but I'd rather find a solution to both. Thanks!

EDIT: I give up on fixing 1 based on TomSwift's answer, but can someone please tell me if there is a way to push up the toolbar when they keyboard appears and then drop the toolbar back in place when the keyboard disappears???? THANKS!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

追风人 2024-10-26 09:06:43

我很确定你没有这个选项。在 iOS 中,键盘位置由操作系统控制 - 你可以收到它所在位置的通知,但我认为你无法控制它的去向。您所要求的是将键盘滑入并继续操作,直到它位于屏幕底部工具栏的“上方”。

您见过任何其他应用程序执行此操作吗?

I'm pretty sure you dont have this option. In iOS the keyboard position is controlled by the OS - you can get notifications of where it is but I dont think you can control where it goes. What you're asking for is to slide the keyboard in and keep going until it's "above" your toolbar at the bottom of the screen.

Have you seen any other apps that do this?

通知家属抬走 2024-10-26 09:06:43

工具栏在隐藏时消失,因为它已添加到另一个视图,因此从其原始视图中删除。您需要像最初一样重新添加它。

The toolbar disappears upon hiding because it has been added to another view, and therefore removed from its original view. You'll need to re-add it as you initially did.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文