Skip to content

Commit 8914c9a

Browse files
committed
Prevent triggering contentSize when it's already the same – this cause TableView to scroll to top on some contentInset changes
1 parent da1b197 commit 8914c9a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

TPKeyboardAvoiding/TPKeyboardAvoidingTableView.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ -(void)setFrame:(CGRect)frame {
5050
}
5151

5252
-(void)setContentSize:(CGSize)contentSize {
53+
if (CGSizeEqualToSize(contentSize, self.contentSize)) {
54+
// Prevent triggering contentSize when it's already the same
55+
// this cause table view to scroll to top on contentInset changes
56+
return;
57+
}
5358
[super setContentSize:contentSize];
5459
[self TPKeyboardAvoiding_updateContentInset];
5560
}

0 commit comments

Comments
 (0)