【发布时间】:2015-11-29 19:20:23
【问题描述】:
我尝试将三个键盘快捷键添加到我的 iPad 程序中。这是三个
// add the "change Status" keyboard shortcut
let statusShortcut = UIKeyCommand(input: "s", modifierFlags: UIKeyModifierFlags.Command, action: "changeStatusPressed:", discoverabilityTitle: "Change Status of Meeting")
addKeyCommand(statusShortcut)
// add the "add user" keyboard shortcut
let addShortcut = UIKeyCommand(input: "+", modifierFlags: UIKeyModifierFlags.Command, action: "addButtonPressed:", discoverabilityTitle: "Add Participant to Meeting")
addKeyCommand(addShortcut)
// add the "remove user" keyboard shortcut
let removeShortcut = UIKeyCommand(input: "-", modifierFlags: UIKeyModifierFlags.Command, action: "removeButtonPressed:", discoverabilityTitle: "Remove Participant to Meeting")
addKeyCommand(removeShortcut)
当我按下键盘上的 Command 键时,只有后两个被识别并显示在屏幕叠加层中。此外,只有后两个有效。
所有动作都被正确定义。建议将不胜感激。
【问题讨论】:
-
为了保证没有排序问题,我把上面三个的顺序都改了,还是只能看到+和-键修饰符。
-
我给了一个很晚的答案,希望对你有帮助!
标签: ios swift keyboard shortcut