Comments (15)
To be totally honest, I've never tested it out with UIRefreshControl
. I'm not a big fan of that control.
The scrollview it self isn't modified by the library, so UIRefreshControl
should respond normally to it and display the control.
Have you tried using this API?
- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView {
return YES;
}
Does the UIRefreshControl
at least show up?
from dznemptydataset.
@allaire @rene-dohan Working with a CollectionView I had to implement these two delegates in order to restore the pull-to-refresh gesture (even if the emptyDataSetShouldAllowTouch
is marked as true
by default... Weird but it works.):
func emptyDataSetShouldAllowScroll(_ scrollView: UIScrollView!) -> Bool {
return true
}
func emptyDataSetShouldAllowTouch(_ scrollView: UIScrollView!) -> Bool {
return true
}
Hope it helps.
from dznemptydataset.
In case anyone made mistake like me, with the override method above, please make sure you have set self.tableview.emptyDataSetDelegate = self
Without this line, refresh control will never show up.
from dznemptydataset.
Maybe it'll help someone as a temp solution.
func emptyDataSetShouldAllowScroll(_ scrollView: UIScrollView!) -> Bool {
return true
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
guard let view = scrollView.value(forKey: "emptyDataSetView") as? UIView else {return}
view.frame = CGRect(x: view.frame.origin.x, y: scrollView.contentOffset.y, width: view.bounds.width, height: view.bounds.height)
}
from dznemptydataset.
Addendum: I'm using the latest version available through CocoaPods (1.4.1).
from dznemptydataset.
That fixes the pull-to-refresh gesture. Oddly enough, the manual invocation of beginRefreshing
still seems to be broken, but that would be acceptable given that the gesture is usable.
However, the empty dataset view now scrolls down during the pull gesture, which is not exactly the desired behaviour. But since offsetForEmptyDataSet:
is not called during scrolling, I guess there is no way around that?
from dznemptydataset.
Not currently, no. Sorry.
Glad to know that the issue was something related to the scrollview.
Thing is, the empty data set view is nested inside of the scrollView, so it's nearly impossible not to scroll it, if the scroll is enabled.
from dznemptydataset.
Actually, the desired sticky behaviour can be achieved as follows:
- (void) scrollViewDidScroll:(UIScrollView *)scrollView {
UIView *v = [scrollView emptyDataSetView];
v.frame = CGRectMake(v.frame.origin.x, scrollView.contentOffset.y, v.frame.size.width, v.frame.size.height);
}
Which also fixes the wrong offset. Only problem with this solution is that there is no way to access the empty dataset view (I just made the accessor public for testing purposes). So unless this is something you might consider incorporating, I guess I will have to fork...
from dznemptydataset.
This seems to be a decent solution actually.
Please do fork, and submit a PR exposing the emptyDataSetView
as a readOnly
property. And if you can add a UIRefreshControl
to any of the example projects (Countries, perhaps), that would be great for illustrating this workaround.
from dznemptydataset.
Unfortunately release 1.5 has broken my nice workaround, now there is a nasty glitch where the empty dataset view moves down a view pixels and immediately in the correct position again afterwards once the refreshing starts, and I don't know yet why this happens. So the pull request is postponed for the time being...
from dznemptydataset.
That's weird. If you could investigate, would be great.
from dznemptydataset.
On the meantime, I'll expose the emptyDataSetView
as a readOnly
property.
from dznemptydataset.
@leoschweizer Did you fix it?
from dznemptydataset.
@allaire No, I figured that simply using the background view of a UITableView
is a much more reliable solution for my use case than working around the design of this library.
from dznemptydataset.
Tried UIRefreshControl with
- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView {
return YES;
}
but it just don't work...
from dznemptydataset.
Related Issues (20)
- Crash DZNEmptyDataSet HOT 1
- emptyView beyond current window
- Blank page display error on TableView or CollectionView
- SwiftPM Support / swift package init HOT 1
- 自定义空白占位图不显示 HOT 1
- Create a new release to make SPM take effect HOT 4
- customer HOT 1
- 刷新导致奔溃的问题 -[UIScrollView(DZNEmptyDataSet) dzn_reloadEmptyDataSet] HOT 6
- Wrong offset of empty data view position. HOT 3
- About the custom view cannot respond to the click event HOT 2
- support swift 5 ? HOT 1
- UITapGestureRecognizer cannot work in customView HOT 2
- 滚动一段距离y,再刷新,刚好数据为空,这时占位图也会偏移y,解决方法如下: HOT 2
- EmptyDataSetView fadeIn Animation is not working (fadeInOnDisplay should be set before the view is added into his superview so that the fade in animation can be applied.) HOT 1
- App crashed with unrecognized selector setClaCustomViewVisible
- tableViewHeader may be covered
- Is there a swift version
- SPM defaults to v1.8.1, but that version has no Package.swift HOT 5
- DetailLabel and TitleLabel layout is NOT set well HOT 1
- offset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dznemptydataset.