@@ -425,6 +425,7 @@ - (CGFloat)slk_topBarsHeight
425425 }
426426
427427 topBarsHeight += CGRectGetHeight ([UIApplication sharedApplication ].statusBarFrame );
428+
428429 return topBarsHeight;
429430}
430431
@@ -2001,12 +2002,14 @@ - (UIKeyCommand *)slk_returnKeyCommand
20012002 UIKeyCommand *command = [UIKeyCommand keyCommandWithInput: @" \r " modifierFlags: 0 action: @selector (didPressReturnKey: )];
20022003
20032004#ifdef __IPHONE_9_0
2004- // Only available since iOS 9
2005- if (self.textInputbar .isEditing ) {
2006- command.discoverabilityTitle = [self .textInputbar.editorRightButton titleForState: UIControlStateNormal] ? : NSLocalizedString(@" Commit Editing" , nil );
2007- }
2008- else if (self.textView .text .length > 0 ) {
2009- command.discoverabilityTitle = [self .rightButton titleForState: UIControlStateNormal] ? : NSLocalizedString(@" Send" , nil );
2005+ if ([UIKeyCommand respondsToSelector: @selector (keyCommandWithInput:modifierFlags:action:discoverabilityTitle: )] ) {
2006+ // Only available since iOS 9
2007+ if (self.textInputbar .isEditing ) {
2008+ command.discoverabilityTitle = [self .textInputbar.editorRightButton titleForState: UIControlStateNormal] ? : NSLocalizedString(@" Commit Editing" , nil );
2009+ }
2010+ else if (self.textView .text .length > 0 ) {
2011+ command.discoverabilityTitle = [self .rightButton titleForState: UIControlStateNormal] ? : NSLocalizedString(@" Send" , nil );
2012+ }
20102013 }
20112014#endif
20122015
@@ -2018,15 +2021,17 @@ - (UIKeyCommand *)slk_escKeyCommand
20182021 UIKeyCommand *command = [UIKeyCommand keyCommandWithInput: UIKeyInputEscape modifierFlags: 0 action: @selector (didPressEscapeKey: )];
20192022
20202023#ifdef __IPHONE_9_0
2021- // Only available since iOS 9
2022- if (self.isAutoCompleting ) {
2023- command.discoverabilityTitle = NSLocalizedString(@" Exit Auto-Completion" , nil );
2024- }
2025- else if (self.textInputbar .isEditing ) {
2026- command.discoverabilityTitle = [self .textInputbar.editorRightButton titleForState: UIControlStateNormal] ? : NSLocalizedString(@" Exit Editing" , nil );
2027- }
2028- else if (!self.isExternalKeyboardDetected && self.keyboardHC .constant != 0 ) {
2029- command.discoverabilityTitle = NSLocalizedString(@" Hide Keyboard" , nil );
2024+ if ([UIKeyCommand respondsToSelector: @selector (keyCommandWithInput:modifierFlags:action:discoverabilityTitle: )] ) {
2025+ // Only available since iOS 9
2026+ if (self.isAutoCompleting ) {
2027+ command.discoverabilityTitle = NSLocalizedString(@" Exit Auto-Completion" , nil );
2028+ }
2029+ else if (self.textInputbar .isEditing ) {
2030+ command.discoverabilityTitle = [self .textInputbar.editorRightButton titleForState: UIControlStateNormal] ? : NSLocalizedString(@" Exit Editing" , nil );
2031+ }
2032+ else if (!self.isExternalKeyboardDetected && self.keyboardHC .constant != 0 ) {
2033+ command.discoverabilityTitle = NSLocalizedString(@" Hide Keyboard" , nil );
2034+ }
20302035 }
20312036#endif
20322037
@@ -2039,11 +2044,13 @@ - (UIKeyCommand *)slk_arrowKeyCommand:(NSString *)inputUpArrow
20392044
20402045#ifdef __IPHONE_9_0
20412046 // Only available since iOS 9
2042- if ([inputUpArrow isEqualToString: UIKeyInputUpArrow]) {
2043- command.discoverabilityTitle = NSLocalizedString(@" Move Up" , nil );
2044- }
2045- if ([inputUpArrow isEqualToString: UIKeyInputDownArrow]) {
2046- command.discoverabilityTitle = NSLocalizedString(@" Move Down" , nil );
2047+ if ([UIKeyCommand respondsToSelector: @selector (keyCommandWithInput:modifierFlags:action:discoverabilityTitle: )] ) {
2048+ if ([inputUpArrow isEqualToString: UIKeyInputUpArrow]) {
2049+ command.discoverabilityTitle = NSLocalizedString(@" Move Up" , nil );
2050+ }
2051+ if ([inputUpArrow isEqualToString: UIKeyInputDownArrow]) {
2052+ command.discoverabilityTitle = NSLocalizedString(@" Move Down" , nil );
2053+ }
20472054 }
20482055#endif
20492056
0 commit comments