Skip to content

Commit

Permalink
Merge pull request #1 from gaohaoyun/master
Browse files Browse the repository at this point in the history
bugfix
  • Loading branch information
BarredEwe authored Feb 20, 2020
2 parents a7468d1 + feafcc9 commit fcbbaa8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
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

0 comments on commit fcbbaa8

Please sign in to comment.