Skip to content

Commit

Permalink
Prevent bottom content inset from being negative.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
planetaryscale authored and michaeltyson committed Nov 8, 2020
1 parent ab67774 commit a54949b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a54949b

Please sign in to comment.