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

fix noMoreData not show in the first page #162

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion ESPullToRefresh.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |s|
s.name = 'ESPullToRefresh'
s.version = '2.9'
s.version = '3.0'
s.summary = 'An easy way to use pull-to-refresh and loading-more'
s.description = 'An easiest way to give pull-to-refresh and loading-more to any UIScrollView. Using swift!'
s.homepage = 'https://github.com/eggswift/pull-to-refresh'
Expand Down
2 changes: 1 addition & 1 deletion ESPullToRefreshExample/ESPullToRefreshExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.9</string>
<string>3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
8 changes: 7 additions & 1 deletion Sources/ESPullToRefresh.swift
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ open class ESRefreshFooterView: ESRefreshComponent {

super.offsetChangeAction(object: object, change: change)

guard isRefreshing == false && isAutoRefreshing == false && noMoreData == false && isHidden == false else {
guard isRefreshing == false && isAutoRefreshing == false && isHidden == false else {
// 正在loading more或者内容为空时不相应变化
return
}
Expand All @@ -415,6 +415,12 @@ open class ESRefreshFooterView: ESRefreshComponent {
self.alpha = 1.0
}

if noMoreData == true {
// noMoreData 判断移到 scrollView alpha 之后
// 避免因 alpha = 0.0 在 PullToRefresh 下调用 noticeNoMoreData 不显示
return
}

if scrollView.contentSize.height + scrollView.contentInset.top > scrollView.bounds.size.height {
// 内容超过一个屏幕 计算公式,判断是不是在拖在到了底部
if scrollView.contentSize.height - scrollView.contentOffset.y + scrollView.contentInset.bottom <= scrollView.bounds.size.height {
Expand Down