eggswift / pull-to-refresh

#Busy Re-Building....# An easy way to use pull to refresh and infinite scrolling in Swift. Pod 'ESPullToRefresh'
MIT License
1.82k stars 252 forks source link

need to show noMoreData in the first page #73

Open Jenus opened 7 years ago

Jenus commented 7 years ago

Hi, there was one condition to show nomoredata. All data was fetched when first loading. "scrollView.contentOffset.y + scrollView.contentInset.top ==0" made "self.alpha = 0.0"; when scroll the tableview, enter the condition of instant return. so the footer with nomoredata was 0 alpha, did not display.

The following was one fix:

guard isRefreshing == false && isAutoRefreshing == false && noMoreData == false && isHidden == false else { //++++++++++++++++++++ if noMoreData { //不满一页的时候,需要加载 if scrollView.contentSize.height <= 0.0 || scrollView.contentOffset.y + scrollView.contentInset.top <= 0.0 { self.alpha = 0.0 } else { self.alpha = 1.0 } } //++++++++++++++++++++----end

        // 正在loading more或者内容为空时不相应变化
        return
    }
Jenus commented 7 years ago

In order to display "no More Data" footer to append the first page[ e.g. 5 items/ 10 paging]. In-depth, noMoreData setter method should notify ESRefreshFooterView::offsetChangeAction, so it is reasonable to make independent call "noticeNoMoreData".

so fixit can replaced with the following : //++++++++++++++++++++ if noMoreData { //不满一页的时候,需要加载 if scrollView.contentSize.height > 0.0 self.alpha = 1.0 } //++++++++++++++++++++----end

and,

open var noMoreData = false { didSet { if noMoreData != oldValue { self.animator.refresh(view: self, stateDidChange: noMoreData ? .noMoreData : .pullToRefresh)

Jenus commented 7 years ago

@eggswift,

could you confirm this as one problem? If so, I will expect it fix as soon as possible with new pod. Thanks

Pulichev commented 7 years ago

@Jenus you can use DZNEmptyDataSet for it

yeziahehe commented 5 years ago

Same request.

Can not use DZNEmptyDataSet, because first page has data, just data count less than page size, so need to call noMoreData in first page.