我正在使用Xcode 11测试版并使用催化剂(“复选框”)在Mac上运行iPad应用程序。
我已经能够使用下面的UIKeyCommands从Mac键盘输入:
//the delete button
UIKeyCommand(input: "\u{8}", modifierFlags: [], action: #selector(backspacePress))
//the "return" button
UIKeyCommand(input: "\r", modifierFlags: [], action: #selector(returnPress))
//the up arrow
UIKeyCommand(input: UIKeyCommand.inputUpArrow, modifierFlags: [], action: #selector(upPress))
//letters or numbers
UIKeyCommand(input: "1", modifierFlags: [], action: #selector(keyPressed(sender:)))当我为一个数字创建键命令输入时,它既适用于QWERTY上方的数字行,也适用于键盘右侧的数字键盘。
有人知道在哪里可以找到正确的转义序列,如\r或\u{8},可以用来检测数字键盘的"enter“键上的按键?
非常感谢你的帮助!

(我确实看到您可以传递.numericPad的修饰符标志,但我相信这是用于数字模式下的iOS键盘)
发布于 2019-10-19 21:48:38
答案是:
UIKeyCommand(input: "\u{3}", modifierFlags: [], action: #selector(enterPress))https://stackoverflow.com/questions/56963348
复制相似问题