iPhone UIWebView - 可以在输入文本字段上关闭自动完成吗? [英] iPhone UIWebView - Can auto complete be turned off on a input text field?

查看:21
本文介绍了iPhone UIWebView - 可以在输入文本字段上关闭自动完成吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了很多&对此的答案很低,我似乎无法找到答案或其他有同样问题的人.希望有人可以提供帮助?

我有一个用于注册的网页,我正在 iPhone UIWebView 中查看该网页.一位用户询问我们是否可以停止输入电子邮件地址的第一个字母.我认为这无关紧要,但显然它可以用于某些电子邮件系统上的本地部分(显然只有域不区分大小写).

看来自动完成是罪魁祸首.我已经尝试将 autocomplete="off" 添加到 html 中的输入元素,但 iOS 显然忽略了它:

可以在 UIWebView 中的 html 输入文本字段上关闭自动完成吗?

谢谢

解决方案

Apple 现在似乎有一些文档:

<块引用>

虽然 UIWebView 类不支持 UITextInputTraits直接协议,可以为文本配置一些键盘属性输入元素.例如,您可以包括自动更正和输入元素定义中的自动大写属性指定键盘的行为,如下所示示例.

 

<块引用>

您还可以控制哪种类型的键盘当用户触摸网页中的文本字段时显示.到显示电话键盘、电子邮件键盘或 URL 键盘,使用输入中 type 属性的 tel、email 或 url 关键字元素,分别.要显示数字键盘,请设置值模式属性为[0-9]"或d".

这些关键字和模式属性是 HTML 5 的一部分,并且是在 iOS 3.1 及更高版本中可用.以下列表显示了如何显示每种类型的键盘,包括标准键盘.

文本:

电话:

网址:

邮箱:

邮政编码:

http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html#Configuring the Keyboard for Web Views

I've searched high & low for an answer on this and I can't seem to find an answer or anybody else having the same issue. Hope some one can assist?

I have a web page for signup which I'm viewing in an iPhone UIWebView. A user is asking if we can stop capitalization on the first letter of the email address being entered. I thought this didn't matter, but apparently it can for the local-part on some email systems (apparently it's only the domain that is only case insensitive).

It seems autocomplete is the culprit. I've tried adding autocomplete="off" to the input element in the html, but iOS is obviously ignoring it:

Can auto-complete be turned off on a html input text field within a UIWebView?

Thanks

解决方案

Seems like Apple have some documentation now:

Although the UIWebView class does not support the UITextInputTraits protocol directly, you can configure some keyboard attributes for text input elements. For example, you can include autocorrect and auto-capitalization attributes in the definition of an input element to specify the keyboard’s behaviors, as shown in the following example.

   <input type="text" size="30" autocorrect="off" autocapitalize="off">

You can also control which type of keyboard is displayed when a user touches a text field in a web page. To display a telephone keypad, an email keyboard, or a URL keyboard, use the tel, email, or url keywords for the type attribute on an input element, respectively. To display a numeric keyboard, set the value of the pattern attribute to "[0-9]" or "d".

These keywords and the pattern attribute are part of HTML 5, and are available in iOS 3.1 and later. The following list shows how to display each type of keyboard, including the standard keyboard.

Text: <input type="text"></input>

Telephone: <input type="tel"></input>

URL: <input type="url"></input>

Email: <input type="email"></input>

Zip code: <input type="text" pattern="[0-9]*"></input>

http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html#Configuring the Keyboard for Web Views

这篇关于iPhone UIWebView - 可以在输入文本字段上关闭自动完成吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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