Skip to content

Commit f533c6c

Browse files
author
Gabor Kovacs
committed
Scrollview stuttering problem on content inset/offset change fixed
1 parent ff9bb8f commit f533c6c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

TPKeyboardAvoiding/UIScrollView+TPKeyboardAvoidingAdditions.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ - (void)TPKeyboardAvoiding_keyboardWillShow:(NSNotification*)notification {
7979
}
8080

8181
self.scrollIndicatorInsets = self.contentInset;
82+
[self layoutIfNeeded];
8283

8384
[UIView commitAnimations];
8485
}
@@ -104,6 +105,7 @@ - (void)TPKeyboardAvoiding_keyboardWillHide:(NSNotification*)notification {
104105

105106
self.contentInset = state.priorInset;
106107
self.scrollIndicatorInsets = state.priorScrollIndicatorInsets;
108+
[self layoutIfNeeded];
107109
[UIView commitAnimations];
108110
}
109111

@@ -156,6 +158,7 @@ -(void)TPKeyboardAvoiding_scrollToActiveTextField {
156158
// scroll to the desired content offset. So we wrap in our own animation block.
157159
[UIView animateWithDuration:0.25 animations:^{
158160
[self setContentOffset:idealOffset animated:NO];
161+
[self layoutIfNeeded];
159162
}];
160163
}
161164

0 commit comments

Comments
 (0)