From 0e3612f1c7ca05beadafb08d3c3e638c45f64458 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Wed, 29 Jan 2014 16:09:01 +0100 Subject: [PATCH] Fixed issue #76. In TPKeyboardAvoiding_calculatedContentSizeFromSubviewFrames, the scroll indicators were included in the subview frame calculations. Now we save the visibility of the scroll indicators, then turn them off while we calculate the new contentSize, then restore the scroll indicator visibility state. --- .../UIScrollView+TPKeyboardAvoidingAdditions.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m b/TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m index c0268739..11a544ac 100644 --- a/TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m +++ b/TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m @@ -203,14 +203,26 @@ - (void)TPKeyboardAvoiding_assignTextDelegateForViewsBeneathView:(UIView*)view { } -(CGSize)TPKeyboardAvoiding_calculatedContentSizeFromSubviewFrames { + + BOOL wasShowingVerticalScrollIndicator = self.showsVerticalScrollIndicator; + BOOL wasShowingHorizontalScrollIndicator = self.showsHorizontalScrollIndicator; + + self.showsVerticalScrollIndicator = NO; + self.showsHorizontalScrollIndicator = NO; + CGRect rect = CGRectZero; for ( UIView *view in self.subviews ) { rect = CGRectUnion(rect, view.frame); } rect.size.height += kCalculatedContentPadding; + + self.showsVerticalScrollIndicator = wasShowingVerticalScrollIndicator; + self.showsHorizontalScrollIndicator = wasShowingHorizontalScrollIndicator; + return rect.size; } + - (UIEdgeInsets)TPKeyboardAvoiding_contentInsetForKeyboard { TPKeyboardAvoidingState *state = self.keyboardAvoidingState; UIEdgeInsets newInset = self.contentInset;