File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,16 @@ typedef NS_ENUM(NSUInteger, CYRKeyboardButtonStyle) {
5555 */
5656extern NSString *const CYRKeyboardButtonPressedNotification;
5757
58+ /* *
59+ Notifies observers that the keyboard button has show the expanded input view. The affected button is stored in the object parameter of the notification.
60+ */
61+ extern NSString *const CYRKeyboardButtonDidShowExpandedInputNotification;
62+
63+ /* *
64+ Notifies observers that the keyboard button has hidden the expanded input view. The affected button is stored in the object parameter of the notification.
65+ */
66+ extern NSString *const CYRKeyboardButtonDidHideExpandedInputNotification;
67+
5868/* *
5969 The key used to fetch the pressed key string from the userInfo dictionary returned when CYRKeyboardButtonPressedNotification is fired.
6070 */
Original file line number Diff line number Diff line change 3535#import " CYRKeyboardButtonView.h"
3636
3737NSString *const CYRKeyboardButtonPressedNotification = @" CYRKeyboardButtonPressedNotification" ;
38+ NSString *const CYRKeyboardButtonDidShowExpandedInputNotification = @" CYRKeyboardButtonDidShowExpandedInputNotification" ;
39+ NSString *const CYRKeyboardButtonDidHideExpandedInputNotification = @" CYRKeyboardButtonDidHideExpandedInputNotification" ;
3840NSString *const CYRKeyboardButtonKeyPressedKey = @" CYRKeyboardButtonKeyPressedKey" ;
3941
4042@interface CYRKeyboardButton () <UIGestureRecognizerDelegate>
@@ -235,6 +237,8 @@ - (void)showExpandedInputView:(UILongPressGestureRecognizer *)recognizer
235237 [self .window addSubview: expandedButtonView];
236238 self.expandedButtonView = expandedButtonView;
237239
240+ [[NSNotificationCenter defaultCenter ] postNotificationName: CYRKeyboardButtonDidShowExpandedInputNotification object: self ];
241+
238242 [self hideInputView ];
239243 }
240244 } else if (recognizer.state == UIGestureRecognizerStateCancelled || recognizer.state == UIGestureRecognizerStateEnded) {
@@ -254,6 +258,10 @@ - (void)hideInputView
254258
255259- (void )hideExpandedInputView
256260{
261+ if (self.expandedButtonView .type == CYRKeyboardButtonViewTypeExpanded) {
262+ [[NSNotificationCenter defaultCenter ] postNotificationName: CYRKeyboardButtonDidHideExpandedInputNotification object: self ];
263+ }
264+
257265 [self .expandedButtonView removeFromSuperview ];
258266 self.expandedButtonView = nil ;
259267}
You can’t perform that action at this time.
0 commit comments