在 iPhone 独立 Web 应用程序中从键盘中删除表单助手
是否可以在独立的 Web 应用程序中从 iPhone 弹出键盘中删除表单助手?我知道普遍的共识是,这在 Mobile Safari 中是不可能的,但独立应用程序在 UIWebView
中运行,并且在多种方面有不同的功能(示例),所以我希望这是可能的。
您可以在键盘上方看到它:
上一个和下一个按钮在 <; 之间循环。表单>
输入。但我有一个 元素,因此它们被禁用。 “完成”按钮隐藏了键盘,但由于我有一个高度灵活的
(占据键盘和
之间的空间),我在这一页上没有其他任何内容,它没有任何作用。在小屏幕上,键盘占据了几乎一半的屏幕,构成此工具栏的 44 个像素是对空间的巨大浪费(整个
的价值)。原生 iOS 应用可以删除它,所以我知道这至少可以在手机上实现,只是我还没有找到在网络应用中实现这一点的方法。这是来自 Facebook 应用程序,该页面与我的非常相似:
我尝试使用 < code> 未包装在
有什么办法可以删除网络应用程序中的表单助手吗?
Is it possible to remove the form assistant from the iPhone popup keyboard in a standalone web app? I know the general consensus is that it's not possible in Mobile Safari, but a standalone app runs in a UIWebView
, and functions differently in several ways (example), so I'm hoping this might be possible.
You can see it here right above the keyboard:
The Previous and Next buttons cycle between <form>
inputs. But I have a single <input>
element, so they are disabled. The Done button hides the keyboard, but since I have a height-flexible <ul>
(that takes up the space between the keyboard and the <input>
), and I have nothing else on this page, it serves no purpose.
On a tiny screen, and with almost half the screen taken up by the keyboard, the 44 pixels that make up this toolbar are a huge waste of space (an entire <li>
's worth).
Native iOS apps can remove it, so I know it's at least possible on the phone, I've just not discovered a way to do it in a web app. This is from the Facebook app and the page is very similar to mine:
I've tried using an <input>
not wrapped in a <form>
and also using a contenteditable
<div>
, but the results were the same. There are several custom -webkit-
styles to control various aspects of the web app interface, but they are poorly documented, and a search turned up nothing on this.
Any way to remove the form assistant in a web app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您的应用程序是包装在本机 Objective-C 应用程序中的 Web 应用程序,则可以通过操作键盘视图来实现。
首先,注册接收keyboardDidShow通知:
当键盘显示时,这将调用以下方法:
此方法遍历屏幕上的视图,查找表单助手并将其隐藏。
注意:Apple 可能不会拒绝这一点,因为我已经看到 Facebook 等公司正在使用它,但这项技术可能会在即将发布的 iOS 版本中被打破。
If you app is a web app wrapped in a native Objective-C app this is possible by manipulating Keyboard views.
first, register to receive the keyboardDidShow notification:
this will call the following method when keyboard shows up:
this method goes over the views on screen looking for the form assistant and hiding it.
NOTE: Apple probably won't reject this, as i've seen it being used by Facebook etc, but this technique might break in upcoming iOS releases.
所有迹象都表明不可能 ,包括几个 问题 此处。
All signs point to this not being possible, including several questions here.
您可以创建 UIView 的类别并“覆盖” addSubview: 的行为,如下例所示。从 AppDelegate 的 applicationDidFinishLaunching 中调用方法“exachangeMethods”。
You can do a category of UIView and "override" the behaviour of addSubview: like the example below. Call the method "exachangeMethods" from your applicationDidFinishLaunching of your AppDelegate.