2

我正在使用 Xcode 11 beta 并使用 Catalyst(“复选框”)在 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}我可以用来检测数字键盘的“输入”键上的按键?

非常感谢您的帮助!

在此处输入图像描述

(我确实看到您可以传递修饰符标志,.numericPad但我相信这是在数字模式下适用于 iOS 键盘)

4

1 回答 1

1

答案是:

UIKeyCommand(input: "\u{3}", modifierFlags: [], action: #selector(enterPress))
于 2019-10-19T21:48:38.300 回答