From 52ad70a5dae844a98b9ed5b867247172ae77c6fc Mon Sep 17 00:00:00 2001 From: Denis Beklarov Date: Thu, 18 Oct 2018 16:51:44 +0200 Subject: [PATCH 1/2] Fixed iphone x gab caused by safe area at the bottom --- lib/ObservingInputAccessoryView.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ObservingInputAccessoryView.m b/lib/ObservingInputAccessoryView.m index e472679..33b99a7 100644 --- a/lib/ObservingInputAccessoryView.m +++ b/lib/ObservingInputAccessoryView.m @@ -85,10 +85,15 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N centerY = [change[NSKeyValueChangeNewKey] CGPointValue].y; } - CGFloat boundsH = self.superview.bounds.size.height; + CGFloat bottomPadding = 0; + + if (@available(iOS 11.0, *)) { + UIWindow *window = UIApplication.sharedApplication.keyWindow; + bottomPadding = window.safeAreaInsets.bottom; + } _previousKeyboardHeight = _keyboardHeight; - _keyboardHeight = MAX(0, self.window.bounds.size.height - (centerY - boundsH / 2) - self.intrinsicContentSize.height); + _keyboardHeight = MAX(0, self.window.bounds.size.height - (centerY - boundsH / 2) - self.intrinsicContentSize.height - bottomPadding); [_delegate observingInputAccessoryViewDidChangeFrame:self]; } From 345d5f86595bb7e1ce191658ffe9b8805e08117e Mon Sep 17 00:00:00 2001 From: Denis Beklarov Date: Thu, 18 Oct 2018 17:11:11 +0200 Subject: [PATCH 2/2] Fixed missing variable boundsH --- lib/ObservingInputAccessoryView.m | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ObservingInputAccessoryView.m b/lib/ObservingInputAccessoryView.m index 33b99a7..b1c2682 100644 --- a/lib/ObservingInputAccessoryView.m +++ b/lib/ObservingInputAccessoryView.m @@ -86,6 +86,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N } CGFloat bottomPadding = 0; + CGFloat boundsH = self.superview.bounds.size.height; if (@available(iOS 11.0, *)) { UIWindow *window = UIApplication.sharedApplication.keyWindow;