Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix #39

Merged
merged 1 commit into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ open class NormalFooterAnimator: UIView, CRRefreshProtocol {

open func refresh(view: CRRefreshComponent, stateDidChange state: CRRefreshState) {
switch state {
case .idle:
titleLabel.text = loadingMoreDescription
case .refreshing :
titleLabel.text = loadingDescription
break
Expand Down
10 changes: 8 additions & 2 deletions CRRefresh/CRRefresh/CRRefreshHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,16 @@ open class CRRefreshHeaderView: CRRefreshComponent {
insets.top += animator.execute
insetTDelta = -animator.execute
holdInsetTDelta = -(animator.execute - animator.hold)
UIView.animate(withDuration: CRRefreshComponent.animationDuration, animations: {
var point = scrollView.contentOffset;
point.y = -insets.top
UIView.animate(withDuration: CRRefreshComponent.animationDuration, animations: {

scrollView.contentOffset.y = self.previousOffsetY
scrollView.contentInset = insets
scrollView.contentOffset.y = -insets.top
// scrollView.contentOffset.y = -insets.top
scrollView.setContentOffset(point, animated: false);


}) { (finished) in
DispatchQueue.main.async {
self.handler?()
Expand Down
5 changes: 4 additions & 1 deletion Demo/RefreshController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,13 @@ class RefreshController: BaseViewController {
print("开始加载")
DispatchQueue.main.asyncAfter(deadline: .now() + 2, execute: {
self?.count += 10
self?.tableView.cr.noticeNoMoreData()
self?.tableView.cr.endLoadingMore()
self?.tableView.reloadData()
})
}

tableView.isPagingEnabled = true

}

//MARK: Override
Expand Down