【问题标题】:iOS 9 iphone keyboard issueiOS 9 iphone键盘问题
【发布时间】:2015-12-28 17:26:58
【问题描述】:

我正在构建一个使用 AppFramework Intel 和 Xcode 制作的 ios 应用程序。 文件(html、js、css、img)在应用程序内部,由 UiWebView 加载。 我有一些表单需要用户包含一些值。 当输入字段由于某种原因被按下时,键盘比传统的要大:

这是键盘的外观和应有的外观。

http://backstagedigital.com.br/stackoverflow/keyboard-issue.png


欢迎任何帮助。

谢谢!

【问题讨论】:

    标签: ios objective-c iphone uiwebview appframework


    【解决方案1】:

    根据苹果文档:

    为网页视图配置键盘

    虽然 UIWebView 类不直接支持 UITextInputTraits 协议,但是你可以为文本输入元素配置一些键盘属性。例如,您可以在输入元素的定义中包含 autocorrect 和 autocapitalize 属性来指定键盘的行为,如下例所示。

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

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

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

    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>
    

    你可以在这里找到完整的文章https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html

    【讨论】:

    • 谢谢!我发现 uiwebview 的键盘尺寸比传统的要大,但是添加这个属性会使应用程序更好、更有用。
    猜你喜欢
    • 2011-12-15
    • 1970-01-01
    • 2013-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多