From 410ad97b30691e88bbac4d2fa66e2eecf9bfc060 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 13 Apr 2013 12:08:24 +0200 Subject: Listen for keyboard show and hide notifications Only react to hide notification for now, call lo_keyboard_did_hide() Change-Id: I2f429039d2a84269783d103ad635ff4c407c4a15 --- .../LibreOffice/LibreOffice/AppDelegate.m | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'ios') diff --git a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m index 3a70fa3572b4..223ccf56b4ba 100644 --- a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m +++ b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m @@ -47,6 +47,9 @@ static UIView *theView; lo_set_view_size(bounds.size.width, bounds.size.height); + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil]; + NSThread* thread = [[NSThread alloc] initWithTarget:self selector:@selector(threadMainMethod:) object:nil]; @@ -90,6 +93,28 @@ static UIView *theView; (void) application; } +- (void)keyboardWillShow:(NSNotification *)note +{ + NSDictionary *info = [note userInfo]; + CGRect frameBegin; + CGRect frameEnd; + + [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] getValue:&frameBegin]; + [[info objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&frameEnd]; +} + +- (void)keyboardDidHide:(NSNotification *)note +{ + NSDictionary *info = [note userInfo]; + CGRect frameBegin; + CGRect frameEnd; + + [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] getValue:&frameBegin]; + [[info objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&frameEnd]; + + lo_keyboard_did_hide(); +} + @end void lo_damaged(CGRect rect) -- cgit