带有数字和默认键盘的 UITextField

发布于 2024-08-30 03:16:45 字数 171 浏览 4 评论 0原文

为“邮政编码/邮政编码”字段创建了一个 UITextField,其键盘类型为 UIKeyboardTypeDefault。我想使用默认键盘,但想要数字和数字默认情况下与字母相对应显示的符号。

当您在 Contacts.app 中输入地址时,Apple 会执行此操作。

有人知道如何实现这一目标吗?

Created a UITextField for "Postal Code/ZIP" field with a keyboardType of UIKeyboardTypeDefault. I would like to use the default keyboard but want the numbers & symbols to be shown by default as apposed to letters.

Apple does this when you are entering addresses in the Contacts.app.

Anyone know how to get this accomplished?

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

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

发布评论

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

评论(2

哀由 2024-09-06 03:16:45

您需要 UIKeyboardTypeNumbersAndPunctuation 键盘类型。

You want the UIKeyboardTypeNumbersAndPunctuation keyboard type.

风透绣罗衣 2024-09-06 03:16:45

executor21 所说的代码示例:

UITextField* txt = [[UITextField alloc] init];
txt.keyboardType = UIKeyboardTypeNumbersAndPunctuation;

And a code example of what executor21 said:

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