Skip to content

Commit

Permalink
Merge pull request #233 from canicelebrate/master
Browse files Browse the repository at this point in the history
fix the issue that origin contentInset of table view will be overrided
  • Loading branch information
michaeltyson authored Dec 8, 2016
2 parents 2d6cdf9 + 8471dd4 commit c30c491
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ - (void)TPKeyboardAvoiding_keyboardWillShow:(NSNotification*)notification {
[UIView setAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]];
[UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]];

self.contentInset = [self TPKeyboardAvoiding_contentInsetForKeyboard];

UIView *firstResponder = [self TPKeyboardAvoiding_findFirstResponderBeneathView:self];
if ( firstResponder ) {

self.contentInset = [self TPKeyboardAvoiding_contentInsetForKeyboard];

CGFloat viewableHeight = self.bounds.size.height - self.contentInset.top - self.contentInset.bottom;
[self setContentOffset:CGPointMake(self.contentOffset.x,
[self TPKeyboardAvoiding_idealOffsetForView:firstResponder
Expand Down

0 comments on commit c30c491

Please sign in to comment.