Skip to content

Commit feafcc9

Browse files
author
GaoHaoyun
committed
bugfix
1、修复:footer 在 `resetNoMore` 后 footer文案任然保持 noMoreData, 2、修复:修复CRAnimation#38 开启了pagingEnabled功能,刷新和加载更多将立即回弹问题
1 parent ffde428 commit feafcc9

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

CRRefresh/CRRefresh/Animators/NormalAnimator/NormalFooterAnimator.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ open class NormalFooterAnimator: UIView, CRRefreshProtocol {
8888

8989
open func refresh(view: CRRefreshComponent, stateDidChange state: CRRefreshState) {
9090
switch state {
91+
case .idle:
92+
titleLabel.text = loadingMoreDescription
9193
case .refreshing :
9294
titleLabel.text = loadingDescription
9395
break

CRRefresh/CRRefresh/CRRefreshHeaderView.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,16 @@ open class CRRefreshHeaderView: CRRefreshComponent {
6666
insets.top += animator.execute
6767
insetTDelta = -animator.execute
6868
holdInsetTDelta = -(animator.execute - animator.hold)
69-
UIView.animate(withDuration: CRRefreshComponent.animationDuration, animations: {
69+
var point = scrollView.contentOffset;
70+
point.y = -insets.top
71+
UIView.animate(withDuration: CRRefreshComponent.animationDuration, animations: {
72+
7073
scrollView.contentOffset.y = self.previousOffsetY
7174
scrollView.contentInset = insets
72-
scrollView.contentOffset.y = -insets.top
75+
// scrollView.contentOffset.y = -insets.top
76+
scrollView.setContentOffset(point, animated: false);
77+
78+
7379
}) { (finished) in
7480
DispatchQueue.main.async {
7581
self.handler?()

Demo/RefreshController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,13 @@ class RefreshController: BaseViewController {
7878
print("开始加载")
7979
DispatchQueue.main.asyncAfter(deadline: .now() + 2, execute: {
8080
self?.count += 10
81-
self?.tableView.cr.noticeNoMoreData()
81+
self?.tableView.cr.endLoadingMore()
8282
self?.tableView.reloadData()
8383
})
8484
}
85+
86+
tableView.isPagingEnabled = true
87+
8588
}
8689

8790
//MARK: Override

0 commit comments

Comments
 (0)