不支持 Xcode iOS 8 键盘类型
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24871532/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode iOS 8 Keyboard types not supported
提问by r4id4
I have a UITextField
Ctrl-dragged as an @Outlet
in my .swift
class.
Now in viewDidLoad
i'm using this code
我在我的班级中有一个UITextField
Ctrl 拖动。现在我正在使用此代码@Outlet
.swift
viewDidLoad
self.myTextField.keyboardType = UIKeyboardType.DecimalPad
When i launch my app on simulator and click on the UITextField
i got this log
当我在模拟器上启动我的应用程序并点击UITextField
我得到这个日志
Can't find keyplane that supports type 8 for keyboard
iPhone-Portrait-DecimalPad;
using 2617181025_Portrait_iPhone-Simple-Pad_Default
I have no crash or something but the keyboard is not displayed. I also tried to set it from Storyboard
but it's the same.
我没有崩溃或什么,但键盘没有显示。我也尝试设置它,Storyboard
但它是一样的。
I also noticed that whenever i click on anyUITextField
the keyboard is never displayed (but no log is shown for the defaultkeyboard)
我还注意到,每当我单击任何UITextField
键盘时,都不会显示键盘(但默认键盘不会显示日志)
I'm using Xcode-Beta 3 anyone faced this issue?
我正在使用 Xcode-Beta 3 有没有人遇到过这个问题?
回答by Tony Abboud
I too had this problem after updating to the latest Xcode Beta. The settings on the simulator are refreshed, so the laptop (external) keyboard was being detected. If you simply press:
更新到最新的 Xcode Beta 后,我也遇到了这个问题。模拟器上的设置已刷新,因此正在检测笔记本电脑(外部)键盘。如果您只需按:
iOS Simulator -> Hardware -> Keyboard -> Connect Hardware Keyboard
then the software keyboard will be displayed once again.
软键盘将再次显示。
回答by Annu
Go to iOS Simulator-> Hardware-> Keyboard ->
Uncheck the Connect Hardware Keyboard
Option.
This will fix the issue.
转到iOS Simulator-> Hardware-> Keyboard ->
取消选中该Connect Hardware Keyboard
选项。这将解决问题。
回答by Gary13
This message comes when the keyboard type is set to numberPad or DecimalPad. But the code works just fine. Looks like its a bug with the new Xcode.
当键盘类型设置为 numberPad 或 DecimalPad 时会出现此消息。但是代码工作得很好。看起来它是新 Xcode 的一个错误。
回答by Erik Bean
If you're getting this bug with Xcode Beta, it's a beta bug and can be ignored (as far as I've been told). If you can build and run on a release build of Xcode without this error, then it is not your app that has the problem.
如果您在 Xcode Beta 中遇到此错误,则这是一个 beta 错误,可以忽略(据我所知)。如果您可以在没有此错误的情况下在 Xcode 的发布版本上构建和运行,那么问题就不是您的应用程序。
Not 100% on this, but see if this fixes the problem:
不是 100%,但看看这是否能解决问题:
iOS Simulator -> Hardware -> Keyboard -> Toggle Software Keyboard.
iOS 模拟器 -> 硬件 -> 键盘 -> 切换软件键盘。
Then, everything works
然后,一切正常
回答by btmanikandan
I have fixed this issue by unchecking 'Connect Hardware Keyboard'. Please refer to the image below to fix this issue
我通过取消选中“连接硬件键盘”解决了这个问题。请参考下图解决此问题
回答by AmitaiB
Xcode: 6.4 iOS:8 I got this error as well, but for a very different reason.
Xcode: 6.4 iOS:8 我也遇到了这个错误,但原因非常不同。
//UIKeyboardTypeNumberPad needs a "Done" button
UIBarButtonItem *doneBarButton = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
action:@selector(doneBarButtonTapped:)];
enhancedNumpadToolbar = [[UIToolbar alloc]init]; // previously declared
[self.enhancedNumpadToolbar setItems:@[doneBarButton]];
self.myNumberTextField.inputAccessoryView = self.enhancedNumpadToolbar; //txf previously declared
I got the same error (save mine was "type 4" rather than "type 8"), until I discovered that I was missing this line:
我遇到了同样的错误(除了我的是“类型 4”而不是“类型 8”),直到我发现我错过了这一行:
[self.enhancedNumpadToolbar sizeToFit];
I added it, and the sun started shining, the birds resumed chirping, and all was well with the world.
我加了它,太阳开始照耀,鸟儿开始鸣叫,世界一切都好。
PS You would also get such an error for other mischief, such as forgetting to alloc/init.
PS 你也会因为其他的恶作剧而得到这样的错误,比如忘记分配/初始化。
回答by Anas
This error had come when your keyboard input type is Number Pad.I got same error than I change my Textfield keyboard input type to Default fix my issue.
当您的键盘输入类型为数字键盘时出现此错误。我遇到的错误与将 Textfield 键盘输入类型更改为 Default 修复我的问题相同。
回答by KeithTheBiped
There is no "Numeric Keypad" for iPads out of the box. When you specify one iPads display the normal keypad with the numeric part displayed. You can switch over to alpha characters, etc. If you want to display a numbers only keyboard for iPad you must implement it yourself.
iPad 没有开箱即用的“数字键盘”。当您指定一台 iPad 时,会显示带有数字部分的普通键盘。您可以切换到字母字符等。如果您想为 iPad 显示仅数字键盘,您必须自己实现。
See here: Number keyboard in iPad?
请参阅此处: iPad 中的数字键盘?
回答by Alfonso Nava
For me turning on and off the setting on
对于我打开和关闭设置
iOS Simulator -> Hardware -> Keyboard -> Connect Hardware Keyboard
iOS 模拟器 -> 硬件 -> 键盘 -> 连接硬件键盘
proved to fix the issue on simulators.
事实证明在模拟器上解决了这个问题。