From 568cbb1499d8a3adeef7a19dafaea15ed56a5b81 Mon Sep 17 00:00:00 2001 From: Guglielmo Faglioni Date: Thu, 26 May 2016 18:01:43 +0200 Subject: [PATCH] added support for hardware keyboards --- WYPopoverController/WYPopoverController.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/WYPopoverController/WYPopoverController.m b/WYPopoverController/WYPopoverController.m index 1595f236..6ba4ddb5 100644 --- a/WYPopoverController/WYPopoverController.m +++ b/WYPopoverController/WYPopoverController.m @@ -2883,7 +2883,16 @@ - (void)keyboardWillShow:(NSNotification *)notification { //UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; //WY_LOG(@"orientation = %@", WYStringFromOrientation(orientation)); //WY_LOG(@"WYKeyboardListener.rect = %@", NSStringFromCGRect(WYKeyboardListener.rect)); - + NSDictionary *userInfo = [notification userInfo]; + CGRect keyboardFrame = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; + CGRect keyboard = [_inView convertRect:keyboardFrame fromView:_inView.window]; + CGFloat height = _inView.frame.size.height; + + if ((keyboard.origin.y + keyboard.size.height) > height) { + //Physical keyboard + return; + } + BOOL shouldIgnore = NO; if (_delegate && [_delegate respondsToSelector:@selector(popoverControllerShouldIgnoreKeyboardBounds:)]) {