我想做一个只使用UIKeyCommand键的[return]。到目前为止,我已经尝试过:
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);我还可以尝试捕获返回/输入键吗?
发布于 2014-02-26 15:28:25
使用@"\r"进行回车而不是对换行符使用@"\n"应该有效。
https://stackoverflow.com/questions/22027522
复制相似问题