eggswift / pull-to-refresh Goto Github PK
View Code? Open in Web Editor NEW#Busy Re-Building....# An easy way to use pull to refresh and infinite scrolling in Swift. Pod 'ESPullToRefresh'
License: MIT License
#Busy Re-Building....# An easy way to use pull to refresh and infinite scrolling in Swift. Pod 'ESPullToRefresh'
License: MIT License
在 ESRefreshHeaderView这个类中有个小小的问题,或者说,我没看明白吧,
public override func startAnimating() {
......
// Navigation will automatically add 64, we are here to deal with part of the logic
if scrollView.contentInset.top != insets.top || scrollView.contentOffset.x != -insets.top {
UIView .animateWithDuration(0.2, animations: {
scrollView.contentInset = insets
scrollView.contentOffset = CGPoint.init(x: scrollView.contentOffset.x, y: -insets.top)
})
}
......
}
您能解释一下,if判断的第二个条件是什么意思?是不是scrollView.contentOffset.y != -inset.top?
OSX 10.11.5
xcode 7.3.1
ESPullToRefresh 1.0.4
在class ESRefreshHeaderAnimator中定义了pullToRefreshDescription。用户可以改动么?
我想像网易那样,在下拉刷新时能显示离上次刷新的时间。请问现在能做到么?如果不能,能否考虑加进去?
多谢。
my dependency specifications in Cartfile
is
github "eggswift/pull-to-refresh" "swift2.3"
when run my app, I get an error from Xcode
error: module file's minimum deployment target is ios9.3
[!] Error installing ESPullToRefresh
[!] /usr/local/bin/git clone /Users/lihao/Workspace/Github/pull-to-refresh /var/folders/yz/ld8zk61n36b6dm12hly91_y40000gn/T/d20161225-36795-h8je64 --template= --single-branch --depth 1 --branch 2.3
fatal: repository '/Users/lihao/Workspace/Github/pull-to-refresh' does not exist
tableview set the dynamic line is high, the load does not stop after the first
removeObserver crashed in ESRefreshComponent - not always but often!
*** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <App.ESRefreshHeaderView 0x108b05430> for the key path "contentOffset" from <App.UITableView 0x1030ec200> because it is not registered as an observer.'
我下载源码添加进项目,图片资源是有了,可还是会出现头部显示不全的问题。请问该如何解决呢
注: 自定义的UICollectionViewLayout,正常layout没问题
用的这个自定义layout https://github.com/fdzsergio/SFFocusViewLayout
Demo 最后一页,预期为 『No more data』,实际 『Loading more』
查看源码
// Back state
UIView.animate(withDuration: 0.3, delay: 0, options: .curveLinear, animations: {
}, completion: { (finished) in
self.animator.refresh(view: self, stateDidChange: .pullToRefresh)
super.stop()
})
stop 函数结束后,默认变更为了 pullToRefresh 导致的 ... 这里重置为 pullToRefresh 的原因是?
期待您的回复。
A shell task (/usr/bin/env git clone --bare --quiet https://github.com/eggswift/ESPullToRefresh.git /Users/thanhngoxuan/Library/Caches/org.carthage.CarthageKit/dependencies/ESPullToRefresh) failed with exit code 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
比如说es.addPullToRefresh
在上拉加载过程中,我不知道为什么,每次第一次结束之后insert Data之后,他都会回滚到TableView顶部。不知道是我的问题还是框架的问题,而当使用reload Data之后,是不会回滚到顶部的。
代码如下:
VC中的代码:
convenience init(url:String){
self.init(nibName: nil, bundle: nil)
self.listModel = ZNListModel.init(baseURL: "http://news.zafu.edu.cn", url:url)
self.tableView.es_addPullToRefresh {
[weak self] in
self?.listModel?.reloadData({
self?.tableView.es_stopPullToRefresh(completion: true)
})
}
self.tableView.es_addInfiniteScrolling {
[weak self] in
self?.listModel?.addNewInfo({
self?.tableView.es_stopLoadingMore()
})
}
}
//数据解析完后的insert
//MARK:Delegate
func finishLoadListView() {
// if self.tableView.numberOfRowsInSection(0) < listModel?.listArray.count {
// let startCount = self.tableView.numberOfRowsInSection(0)
// let endCount = listModel?.listArray.count
//
// var indexPathArr:Array<NSIndexPath> = []
//
// for row in startCount ..< endCount! {
// indexPathArr.append(NSIndexPath.init(forRow: row, inSection: 0))
// }
//
// self.tableView.insertRowsAtIndexPaths(indexPathArr, withRowAnimation: UITableViewRowAnimation.Top)
//// self.tableView.reloadRowsAtIndexPaths(indexPathArr, withRowAnimation: UITableViewRowAnimation.Bottom)
// }else{
self.tableView.reloadData()
// }
}
//model中的代码
func addNewInfo(callback:(()->())?) {
currentPage += 1;
let q = dispatch_queue_create("async_queue", DISPATCH_QUEUE_SERIAL)
let url:String = self.url!+"?page=\(currentPage)"
dispatch_sync(q) {
self.getMessage(url, callback: callback)
}
}
func getMessage(url:String,callback:(()->())?) {
let JiCode = Ji.init(htmlURL: NSURL(string: url)!)
let content = JiCode?.xPath("//div[starts-with(@class,'content-right')]/ul/li/a")
let dates = JiCode?.xPath("//div[starts-with(@class,'content-right')]/ul/li/span")
if content != nil {
for item in content! {
//...解析内容(因为过多已经省去)
// 将对应的顺序放入Array中
self.listArray.append((title,urlStr,date,num))
}
let mainQueue = dispatch_get_main_queue()
dispatch_async(mainQueue, {
if callback != nil{
callback!()
}
self.delegate?.finishLoadListView()
})
}
}
如题,这样的 extension 意义何在?
只能手动加入? 不能通过 frameworks 方式使用?
platform :ios, '8.0'
use_frameworks!
pod 'ESPullToRefresh'
当UICollectionView的
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 0
}
时,下拉刷新无效?并且不在显示ESRefreshHeaderView
when i use cocoapod the icon_pull_to_refresh_arrow@2x image not found
Can you localize this pod for other languages, like zh-Hans, zh-Hant and jp?
Hi,
I want to use pull-to-refresh. But sometimes, I want to disable it, then enable later.
Can I do it with this library?
Thank you.
When pulling to refresh and releasing the table view goes into the fetch new data mode (refreshing). While the data in the background is beeing loaded the user scrolls the table view. The table view has multiple sections with corresponding section headers. While scrolling the section headers normally stick on the table view's top, but not when currently refreshing. In the refreshing state between the section header and the table view's top border is a gap, but shouldn't.
This is because the lib uses insets when refreshing. These results in the gap because the section headers respect the inset, but should stick with the border.
See for a possible solution:
http://stackoverflow.com/questions/5466097/section-headers-in-uitableview-when-inset-of-tableview-is-changed
你这个能否直接支持gif图片?而不是需要导入多张静态图。
我知道了,使用carthage克隆下来的是2.1,2.1是未修复状态..能否打个新release
如Pull to refresh,没有找到现成的方法,只能自定义吗?
self.tableView.es_addPullToRefresh {
[weak self] in
self?.tableView.es_stopPullToRefresh(completion: true)
self?.tableView.es_stopPullToRefresh(completion: true, ignoreFooter: false)
}
提示错误是:value of type “UITableView” has no member ' es_addPullToRefresh'
Any Help with that?
UIImage(named: "icon_pull_to_refresh_arrow", in: Bundle(identifier: "com.eggswift.ESPullToRefresh"), compatibleWith: nil)
获取图片为空
代码如下,当我在一个tableViewController中为tableView添加了下拉刷新和上拉加载,当使用es_startPullToRefresh方法时,发现,下拉刷新和上拉加载都调用了一遍,正常应该是只有下拉刷新被调用,不确定我是不是个例,我的页面中还使用了UISearchController,谢谢
self.tableView.es_addPullToRefresh { [weak self] in
guard self != nil else {return}
self?.getData()
}
self.tableView.es_addInfiniteScrolling { [weak self] in
guard self != nil else {return}
self?.loadMoreData()
}
self.tableView.es_startPullToRefresh()
pod "ESPullToRefresh" 方式安装后 找不到 es_addPullToRefresh 等方法;
直接把源码加到项目里能找到,不知道是不是和我的项目有关
请将项目的deployment target设成满足使用的版本,如7 或 8
github "eggswift/ESPullToRefresh"提示
*** Cloning ESPullToRefresh
A shell task (/usr/bin/env git clone --bare --quiet https://github.com/eggswift/ESPullToRefresh.git /Users/cedricwu/Library/Caches/org.carthage.CarthageKit/dependencies/ESPullToRefresh) failed with exit code 128:
remote: Repository not found.
fatal: repository 'https://github.com/eggswift/ESPullToRefresh.git/' not found
应为 github "eggswift/pull-to-refresh"
额, 不知道是不是我理解错, expriedTimeInterval
是不是手抖了...? 看README.md里的注释是对的, expired
UITableView支持吗?下拉刷新也支持吗?
I'm having some issues right now with this pod. If the list is too small then the pull to refresh KVO never fires. I think this is because there's no scrolling happening.
我的app是开始时显示当天的内容,当tableview滑到底部时会从server端抓前一天的内容。
但是我发现有时不是抓前一天的内容,而是抓前几天的内容。也就是时间都乱了。
但不是都这样。很不稳定。有时显示的正常的。有时就不对。
我看到另一个issue似乎提到了这个问题。不知道和我提的是否一样。
您能看看么?
多谢。
最新2.6 使用默认,发现下拉的时候没有箭头
請問,是否支援Swift 3的語法呢?
Nothing happens if I try the pull down gesture on a empty UiCollectionView. This is a big issue as this is exactly the place where my users would want to check if something has been added on server.
Thanks.
I can't use your lib with carthage. For carthage to work you must have shared your Xcode scheme like that: https://github.com/Carthage/Carthage#supporting-carthage-for-your-framework
當我設定pullToRefreshDescription之後,第一次依然會先顯示Pull to refresh,之後才會變動成新的值。這應該是設定pullToRefreshDescription後沒有更新titleLabel的關係。
Hi, Example project has "refreshIdentifier" related code. When I install this using pods, I'm getting 1.0.3 version which does not have the latest code. Can you please look into it?
`[self.contentView es_addInfiniteScrollingWithHandler:^{
if (numeroCapituloAux != (int)book.caps) {
[self carregaCapituloWithNumeroCapitulo:++numeroCapituloAux];
}
[self.contentView es_stopLoadingMore];
self.contentView.contentOffset = CGPointZero;
[self.contentView scrollRangeToVisible:NSMakeRange(0, 1)];
}];`
if offset >= totalCount {
self.tableView.es_removeRefreshFooter()
} else if tableView.es_footer == nil {
tableView.es_addInfiniteScrolling { [weak self] in
self?.loadMore()
}
}
what kind of version should I use for swift 2.3?
Is there any way that I can edit the text of pull to refresh, load more and no more data without making new customize refresh control by using default control
Any Help?
dome中 把 DefaultTableViewController 中
数据量改为2行 即 缩小到 并没有占满一屏
上拉刷新 改为
self.tableView.es_addInfiniteScrolling {
[weak self] in
let minseconds = 0.1 * Double(NSEC_PER_SEC) //此处改为0.1 加快反馈
let dtime = dispatch_time(DISPATCH_TIME_NOW, Int64(minseconds))
dispatch_after(dtime, dispatch_get_main_queue() , {
self?.page += 1
if self?.page <= 3 {
for _ in 1...1{
self?.array.append(" ")
}
self?.tableView.reloadData()
self?.tableView.es_stopLoadingMore()
} else {
self?.tableView.es_noticeNoMoreData()
}
})
}
会使得在 ESRefreshFooterView.stopAnimating方法 中的scrollView.decelerating为true
造成 执行了
var contentOffset = scrollView.contentOffset
contentOffset.y = min(contentOffset.y, scrollView.contentSize.height - scrollView.frame.size.height)
scrollView.setContentOffset(contentOffset, animated: false)
使cell弹到了 下半屏
建议
public override func stopAnimating() {
guard let scrollView = scrollView else {
return
}
self.animator.refreshAnimationDidEnd(self)
self.animator.refresh(self, stateDidChange: .PullToRefresh)
UIView .animateWithDuration(0.3, delay: 0, options: .CurveLinear, animations: {
self.animator.refresh(self, progressDidChange: 0.0)
}) { (finished) in
super.stopAnimating()
}
}
Currently when providing a custom pull to refresh description for a header the text will only be used after the user has pulled the scroll view once. Before that, in its initial state and the user drags the view the library's default text will be shown. To prevent this I have to use a workaround:
let header = tableView.es_addPullToRefresh { [weak self] in
self?.refreshData()
}
if let animator = header.animator as? ESRefreshHeaderAnimator {
animator.loadingDescription = "My custom text"
animator.pullToRefreshDescription = "My custom text"
animator.releaseToRefreshDescription = "My custom text"
animator.refreshAnimationEnd(view: header) // Workaround to update the header's label (ESPullToRefresh 2.4)
}
When setting the animator.pullToRefreshDescription property it should instantly update the header's label with the given string when in the pullToRefresh state.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.