我想制作一个仅使用 [return]
键的 UIKeyCommand
。到目前为止,我已经尝试过:
UIKeyCommand *selectCommand = [UIKeyCommand keyCommandWithInput:@"\n" modifierFlags:0 action:@selector(chooseSelection:)];
Enter 键没有全局常量,就像向上、向下、向左、向右和转义键一样(来自 UIResponder.h
):
// These are pre-defined constants for use with the input property of UIKeyCommand objects.
UIKIT_EXTERN NSString *const UIKeyInputUpArrow NS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN NSString *const UIKeyInputDownArrow NS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN NSString *const UIKeyInputLeftArrow NS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN NSString *const UIKeyInputRightArrow NS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN NSString *const UIKeyInputEscape NS_AVAILABLE_IOS(7_0);
还有什么我可以 try catch 返回/输入键的吗?
最佳答案
使用 @"\r"
代替 @"\n"
换行应该可行。
关于ios - 如何使用返回/输入键创建 UIKeyCommand?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22027522/