diff --git a/Examples/Messenger-Shared/MessageViewController.m b/Examples/Messenger-Shared/MessageViewController.m index b31e08de..dcbe3c01 100644 --- a/Examples/Messenger-Shared/MessageViewController.m +++ b/Examples/Messenger-Shared/MessageViewController.m @@ -422,15 +422,13 @@ - (void)didPressRightButton:(id)sender [super didPressRightButton:sender]; } -- (void)didPressArrowKey:(id)sender +- (void)didPressArrowKey:(UIKeyCommand *)keyCommand { - UIKeyCommand *keyCommand = (UIKeyCommand *)sender; - if ([keyCommand.input isEqualToString:UIKeyInputUpArrow] && self.textView.text.length == 0) { [self editLastMessage:nil]; } else { - [super didPressArrowKey:sender]; + [super didPressArrowKey:keyCommand]; } } diff --git a/Source/SLKTextView.h b/Source/SLKTextView.h index 905a37e0..962c53e6 100644 --- a/Source/SLKTextView.h +++ b/Source/SLKTextView.h @@ -99,7 +99,7 @@ typedef NS_OPTIONS(NSUInteger, SLKPastableMediaType) { /** Notifies the text view that the user pressed any arrow key. This is used to move the cursor up and down while having multiple lines. */ -- (void)didPressAnyArrowKey:(UIKeyCommand *)keyCommand; +- (void)didPressArrowKey:(UIKeyCommand *)keyCommand; #pragma mark - Markdown Formatting diff --git a/Source/SLKTextView.m b/Source/SLKTextView.m index 4933beaa..c5740a95 100644 --- a/Source/SLKTextView.m +++ b/Source/SLKTextView.m @@ -975,7 +975,7 @@ - (NSArray *)keyCommands #pragma mark Up/Down Cursor Movement -- (void)didPressAnyArrowKey:(UIKeyCommand *)keyCommand +- (void)didPressArrowKey:(UIKeyCommand *)keyCommand { if (![keyCommand isKindOfClass:[UIKeyCommand class]] || self.text.length == 0 || self.numberOfLines < 2) { return; diff --git a/Source/SLKTextViewController.h b/Source/SLKTextViewController.h index 1865e7d0..08ec917c 100644 --- a/Source/SLKTextViewController.h +++ b/Source/SLKTextViewController.h @@ -321,21 +321,21 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController You can override this method to perform additional tasks. You MUST call super at some point in your implementation. */ -- (void)didPressReturnKey:(id)sender NS_REQUIRES_SUPER; +- (void)didPressReturnKey:(UIKeyCommand *)keyCommand NS_REQUIRES_SUPER; /** Notifies the view controller when the user has pressed the Escape key (Esc) with an external keyboard. You can override this method to perform additional tasks. You MUST call super at some point in your implementation. */ -- (void)didPressEscapeKey:(id)sender NS_REQUIRES_SUPER; +- (void)didPressEscapeKey:(UIKeyCommand *)keyCommand NS_REQUIRES_SUPER; /** Notifies the view controller when the user has pressed the arrow key with an external keyboard. You can override this method to perform additional tasks. You MUST call super at some point in your implementation. */ -- (void)didPressArrowKey:(id)sender NS_REQUIRES_SUPER; +- (void)didPressArrowKey:(UIKeyCommand *)keyCommand NS_REQUIRES_SUPER; #pragma mark - Text Input Bar Adjustment diff --git a/Source/SLKTextViewController.m b/Source/SLKTextViewController.m index 5daa3066..e2b937f6 100644 --- a/Source/SLKTextViewController.m +++ b/Source/SLKTextViewController.m @@ -1283,23 +1283,23 @@ - (void)slk_prepareForInterfaceTransitionWithDuration:(NSTimeInterval)duration #pragma mark - Keyboard Events -- (void)didPressReturnKey:(id)sender +- (void)didPressReturnKey:(UIKeyCommand *)keyCommand { if (_textInputbar.isEditing) { - [self didCommitTextEditing:sender]; + [self didCommitTextEditing:keyCommand]; } else { [self slk_performRightAction]; } } -- (void)didPressEscapeKey:(id)sender +- (void)didPressEscapeKey:(UIKeyCommand *)keyCommand { if (self.isAutoCompleting) { [self cancelAutoCompletion]; } else if (_textInputbar.isEditing) { - [self didCancelTextEditing:sender]; + [self didCancelTextEditing:keyCommand]; } if ([self ignoreTextInputbarAdjustment] || ([self.textView isFirstResponder] && self.keyboardHC.constant == 0)) { @@ -1309,9 +1309,9 @@ - (void)didPressEscapeKey:(id)sender [self dismissKeyboard:YES]; } -- (void)didPressArrowKey:(id)sender +- (void)didPressArrowKey:(UIKeyCommand *)keyCommand { - [self.textView didPressAnyArrowKey:sender]; + [self.textView didPressArrowKey:keyCommand]; }