iOS:fix refreshable cannot scroll properly

This commit is contained in:
pengfei.zhou 2021-05-21 18:28:53 +08:00 committed by osborn
parent c1ac0a04a5
commit 783f77e7ac

View File

@ -96,7 +96,17 @@ - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView.contentOffset.y <= 0) { if (scrollView.contentOffset.y <= 0) {
[self.swipePullingDelegate setPullingDistance:-scrollView.contentOffset.y]; if ([self.contentView isKindOfClass:UIScrollView.class]
&& ((UIScrollView *) self.contentView).contentOffset.y > 0) {
scrollView.contentOffset = (CGPoint) {0, 0};
} else {
[self.swipePullingDelegate setPullingDistance:-scrollView.contentOffset.y];
}
} else if (scrollView.contentOffset.y + scrollView.height > scrollView.contentSize.height) {
if ([self.contentView isKindOfClass:UIScrollView.class]
&& ((UIScrollView *) self.contentView).contentOffset.y + self.contentView.height < ((UIScrollView *) self.contentView).contentSize.height) {
scrollView.contentOffset = (CGPoint) {0, scrollView.contentSize.height - scrollView.height};
}
} }
} }