xcode 来自小键盘的 iOS 9/Swift 2 输入找不到键盘
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33005197/
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
iOS 9/Swift 2 input from numpad can't find keyplane
提问by ThinkingInBits
I have some very basic code which reads the text from a textfield when the user presses a button, and updates the text on a label. I have the type of the input field set to number pad.
我有一些非常基本的代码,它们在用户按下按钮时从文本字段中读取文本,并更新标签上的文本。我将输入字段的类型设置为数字键盘。
import UIKit
class ViewController: UIViewController {
@IBOutlet var userGuessTextField: UITextField!
@IBOutlet var resultLabel: UILabel!
@IBAction func guess(sender: AnyObject) {
let randomNumber = String(arc4random_uniform(11))
if randomNumber == userGuessTextField.text {
resultLabel.text = "You're right"
} else {
resultLabel.text = "Wrong! It was a \(randomNumber)"
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
When I trigger my action, xCode throws this error:
当我触发我的操作时,xCode 会引发此错误:
Can't find keyplane that supports type 4 for keyboard iPhone-PortraitTruffle-NumberPad; using 675849259_PortraitTruffle_iPhone-Simple-Pad_Default
iPhone-PortraitTruffle-NumberPad键盘找不到支持type 4的键盘;使用 675849259_PortraitTruffle_iPhone-Simple-Pad_Default
EDIT:
编辑:
Turns out this is not an error at all, but a simple logging statement. I must have accidentally set a breakpoint in my action, giving it the look and feel of a crash. Thank you, first responder.
事实证明这根本不是错误,而是一个简单的日志记录语句。我一定是不小心在我的动作中设置了一个断点,让它看起来和感觉像是崩溃了。谢谢你,第一响应者。
回答by matt
Laugh uncontrollably and just keep going. It's not an error. It's just a bit of fluff dropped into the console. Ignore it.
无法控制地笑,继续前进。这不是错误。这只是落入控制台的一点绒毛。忽略它。
回答by Imran
回答by Jayprakash Dubey
This is not an error.It just says cannot find keyplane..
这不是错误。它只是说找不到键盘..
You can switch to simulator keyboard from Hardware -> Keyboard -> Toggle Software Keyboard
or simply press cmd + shift + k
您可以切换到模拟器键盘,Hardware -> Keyboard -> Toggle Software Keyboard
或者只需按cmd + shift + k
You can even ignore this ;-)
你甚至可以忽略这一点;-)