With this code we can trigger the KeyboardStateChanged event directly as soon as the keyboard close.
www.b4x.com
I need the same when the keyboard is opened, I found the following in the apple documentation:
developer.apple.com
I can't manage to extend the code to this function:
What am I doing wrong?
Keyboard will hide notification
The KeyboardStatePage event is raised before the keyboard becomes visible and after the keyboard is hidden. There are cases where you want to do something right before the keyboard is closed. For example, to start moving a view. 1. Add to Main module at the bottom: #if OBJC @end @interface...

I need the same when the keyboard is opened, I found the following in the apple documentation:

keyboardWillShowNotification | Apple Developer Documentation
A notification that posts immediately prior to displaying the keyboard.
I can't manage to extend the code to this function:
B4X:
#if OBJC
@end
@interface B4IViewController (KeyboardNotifications)
@end
@implementation B4IViewController (KeyboardNotifications)
- (void) addWillHide {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardWillHideNotification object:nil];
}
- (void) addWillShow {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardWillShowNotification object:nil];
}
#end if
What am I doing wrong?