Skip to content

Commit

Permalink
Fixed issue michaeltyson#76. In TPKeyboardAvoiding_calculatedContentS…
Browse files Browse the repository at this point in the history
…izeFromSubviewFrames, 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.
  • Loading branch information
brianpseudo committed Jan 29, 2014
1 parent 1cb7fdb commit 0e3612f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0e3612f

Please sign in to comment.