From a54949b6ca7982aaafd3cad1431353a943fe215e Mon Sep 17 00:00:00 2001 From: Andrew Wooster Date: Thu, 21 Feb 2019 18:00:09 -0800 Subject: [PATCH] Prevent bottom content inset from being negative. On an iPad with a hardware keyboard and the shortcuts bar enabled: If the scroll view has a bounds of: CGRectMake(0, 138, 787, 327) and the keyboard has a bounds of: CGRectMake(0, 713, 1024, 55) Then the bottom inset ended up being -107, which would make the bottom content of the scroll view inaccessible. # Conflicts: # TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m --- TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m b/TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m index d51dca5..06731cb 100644 --- a/TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m +++ b/TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m @@ -345,7 +345,7 @@ - (UIEdgeInsets)TPKeyboardAvoiding_contentInsetForKeyboard { if (keyboardRect.size.height == 0) { newInset.bottom = state.priorInset.bottom; } else { - newInset.bottom = keyboardRect.size.height - MAX((CGRectGetMaxY(keyboardRect) - CGRectGetMaxY(self.bounds)), 0); + newInset.bottom = MAX(keyboardRect.size.height - MAX((CGRectGetMaxY(keyboardRect) - CGRectGetMaxY(self.bounds)), 0), 0); } return newInset;