如何使用return / enter键创buildUIKeyCommand?

我想制作一个只使用[return]键的UIKeyCommand 。 到目前为止我已经尝试过:

 UIKeyCommand *selectCommand = [UIKeyCommand keyCommandWithInput:@"\n" modifierFlags:0 action:@selector(chooseSelection:)]; 

input键没有全局常量,就像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); 

还有什么我可以尝试捕获返回/input密钥?

对于换行符,使用@"\r"来回车,而不是@"\n"