gontovnik / dgelasticpulltorefresh Goto Github PK
View Code? Open in Web Editor NEWElastic pull to refresh for iOS developed in Swift
License: MIT License
Elastic pull to refresh for iOS developed in Swift
License: MIT License
When i pull to refresh, i see a faint line, probably the Nav Bar's border line. While on your display view example, there isn't any line separating the DGElasticPullToRefresh from the Navigation Bar. Thanks in advance :)
Hey !
I am trying to use your beautiful component but I am facing an error I can't solve. One of my view controller uses your DGElasticPullToRefresh
with its circle loading view. But when this view controller is deallocated I got the error :
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7fd7d4343080 of class UIScrollViewPanGestureRecognizer was deallocated while key value observers were still registered with it
Any idea how to solve this ?
Thanks
How to refresh automatically?
Hi, it is a beautiful refresh library, easy create in table
But it has a problem in Collection,can't drag to show ,but had run the function
scrollViewDidChangeContentOffset(dragging: false)
as below the code
let loadingView = DGElasticPullToRefreshLoadingViewCircle()
loadingView.tintColor = UIColor(red: 78/255.0, green: 221/255.0, blue: 200/255.0, alpha: 1.0)
self.collectionView!.dg_addPullToRefreshWithActionHandler({
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(1.5 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC), execute: {
self.collectionView!.dg_stopLoading()
})
}, loadingView: loadingView)
self.collectionView!.dg_setPullToRefreshFillColor(UIColor(red: 57/255.0, green: 67/255.0, blue: 89/255.0, alpha: 1.0))
self.collectionView!.dg_setPullToRefreshBackgroundColor(self.collectionView!.backgroundColor!)
that was test in the demo example code
Thank you
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x12e95fc00 of class UITableView was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x12fc63f10> (
<NSKeyValueObservance 0x12fc34920: Observer: 0x12fc5ada0, Key path: contentOffset, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x12f915730>
)'
already did the de init :(
If a UITableView is set in a xib file and hooked unto the view controller via an IBOutlet, and it includes a tableHeaderView, it disappears after a pull to refresh.
This will be because the IBOutlet only has a weak reference to the UITableView and it is removed from the view heirachy temporarily
This is where is occurs:
public extension UIScrollView {
func dg_stopScrollingAnimation() {
if let superview = self.superview, let index = superview.subviews.indexOf({ $0 == self }) as Int! {
let strongSelf = self
//removeFromSuperview() // commenting out this line fixes the issue, but Im not sure if its needed for something else (changing the index?)
superview.insertSubview(strongSelf, atIndex: index)
}
}
}
Unfortunately the project doesn't build on 2.3
in dg_center:
> if usePresentationLayerIfPossible,
> let presentationLayer = layer.presentationLayer() as? CALayer {
> // Position can be used as a center, because anchorPoint is (0.5, 0.5)
> return presentationLayer.position
> }
> return center
returns the following error:
Downcast from 'CALayer?' to 'CALayer' only unwraps optionals; did you mean to use '!'?
I am not sure why that downcast is there as layer.presentationlayer() seems to return a CALayer. If its unneeded then removing the downcast allows the project to build
That should be an easy fix.
▸ ⚠️ /Pods/DGElasticPullToRefresh/DGElasticPullToRefresh/DGElasticPullToRefreshView.swift:126:61: use '#selector' instead of explicitly constructing a 'Selector'
▸ displayLink = CADisplayLink(target: self, selector: Selector("displayLinkTick"))
▸ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
▸ ⚠️ /Pods/DGElasticPullToRefresh/DGElasticPullToRefresh/DGElasticPullToRefreshView.swift:144:74: use '#selector' instead of explicitly constructing a 'Selector'
▸ NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("applicationWillEnterForeground"), name: UIApplicationWillEnterForegroundNotification, object: nil)
▸ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
▸ Compiling DGElasticPullToRefreshConstants.swift
▸ Compiling DGElasticPullToRefreshExtensions.swift
▸ Compiling DGElasticPullToRefreshLoadingView.swift
▸ Compiling DGElasticPullToRefreshLoadingViewCircle.swift
▸ Compiling DGElasticPullToRefreshView.swift
▸ ⚠️ /Pods/DGElasticPullToRefresh/DGElasticPullToRefresh/DGElasticPullToRefreshView.swift:126:61: use '#selector' instead of explicitly constructing a 'Selector'
▸ displayLink = CADisplayLink(target: self, selector: Selector("displayLinkTick"))
▸ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
▸ ⚠️ /Pods/DGElasticPullToRefresh/DGElasticPullToRefresh/DGElasticPullToRefreshView.swift:144:74: use '#selector' instead of explicitly constructing a 'Selector'
▸ NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("applicationWillEnterForeground"), name: UIApplicationWillEnterForegroundNotification, object: nil)
Actual result:
Refresh view disappears after table refresh and extra table content top inset is added so there is a empty space between nav bar and table content.
After rotation when dragging scroll down:
Expected result:
The same result when isTranslucent = false
Is there quick workaround for that?
It would be nice to have a method to fire the pull to refresh, something like objc dg_startLoading
Need to add
if (!self.observing) { return }
in animateBounce() -> UIView.animateWithDuration -> completion:
or it will cause crash if the tableview is removed before it's called.
The DGElasticPullToRefresh has a top mode refresh by default, how could we use it by the bottom mode?
makes the tableView go under the UINavigation bar.
Here is the code I used to set up the pull to refresh.
// Initialize tableView
let loadingView = DGElasticPullToRefreshLoadingViewCircle()
loadingView.tintColor = UIColor.whiteColor()
tableView.dg_addPullToRefreshWithActionHandler({ weak self -> Void in
self!.loadData()
}, loadingView: loadingView)
tableView.dg_setPullToRefreshFillColor(UIColor(red:0.000000, green:0.764706, blue:0.235294, alpha:1.0))
tableView.dg_setPullToRefreshBackgroundColor(tableView.backgroundColor!)
I installed DGElasticPullToRefresh using cocoapod. So I have version (1.0.3).
It does not build : I have 30 errors.
Is swift 3 support planned ?
Many thanks
DGElasticPullToRefresh is very good,can u support Carthage
I'm create my collectionView in loadView()
method, and if my collection is empty i can't refresh him. What happened? :)
After pulling to refresh, a line appears under the Navigation bar until refresh has finished. Can you point our where in the library this might be occurring?
Im setting an image as the background self.navigationController!.navigationBar.setBackgroundImage(...)
And hiding the shadow with this self.navigationController!.navigationBar.shadowImage = UIImage()
Actual result:
Activity indicator view has invalid position as well as controlPoints positions
Expected result:
I guess desired behaviour would be: finish/skip animatingBounce animation and go straight to loading state after rotation.
I wrote a version for DGElasticPullToRefresh in Objective-C,but is imperfect , need your help
link :https://github.com/Mainstayz/DGElasticPullToRefresh 😊
Hi,
A one-pixel line appears at the moment when when releasing - as can be seen in the attached image. It flashes for the briefest moment in time, but my app's contrast between the two colours is very high so it's quite obvious.
Is this in the library or could it be something weird in the way my UI is put together?
Steps to reproduce:
Effect:
Pull to refresh sometimes stays on screen in some kind of hung state (circle not animating, view half cut). Scrolling the view removes the glitch from screen immediately
Expected effect:
View controller should appear in normal state with pull to refresh either hidden or finishing the animation gracefully.
Any advice on that or is it a bug that needs to be fixed?
Support trigger load from code
Add a func to support simulate the drag and release action to trigger loading.
HI,
is it possibile to use DGElasticPullToRefresh into UICollectionView?
Thanks
Is there a demo example of using this in an Obj-C
project?
Can i ?
When I pull to refresh and have section index enabled, on the pull and drag, the refreshView width gets cut off where the sectionIndex starts. On release, during the circle animation, the refreshView fills the entire width as it should.
I believe this is due to how Apple sets the active width of the scrollView when section Index is enabled, and since this library extends UIScrollView, it acts based on how Apple implements the scrollView behaviour.
Is there any currently known way around this? I'm sure a hacky solution exists, but just wondering if this is something that the library is capable of implementing
Would be useful for smaller screen sizes! Thank you for the awesome work :)
Hello,
The animation looks amazing but I can't get it to work. This is my code:
let loadingView = DGElasticPullToRefreshLoadingViewCircle()
loadingView.tintColor = UIColor.whiteColor()
tableView.dg_addPullToRefreshWithActionHandler({ [weak self] in
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(1.5 * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), {
self?.tableView.dg_stopLoading()
})
}, loadingView: loadingView)
tableView.dg_setPullToRefreshFillColor(UIColor().menuDarkBlueColor())
tableView.dg_setPullToRefreshBackgroundColor(view.backgroundColor!)
Even if I remove the dispatch_after
, as soon as I release the UIScrollView of the tableView, it completely disappears from the hierarchy. As you can see from these screenshots, the UITableView is removed from the hierarchy. Could this be due to a bug in your library?
The first screenshot is before reloading, the second one is while the pull to refresh animation is in course and the last is when the UIScrollView is released. You can find my source code here: https://github.com/BalestraPatrick/Tweetometer
First
Second
Third
I have a problem, A present B, B dismiss, but B was not destroyed.
I think Dg_removePullToRefresh should not be called in deinit,
Because only call Dg_removePullToRefresh,B will be destroyed。
I modified the dg_removePullToRefresh。
public func dg_removePullToRefresh() { self.pullToRefreshView?.disassociateDisplayLink() self.pullToRefreshView?.observing = false self.pullToRefreshView?.removeFromSuperview() if self.pullToRefreshView != nil { self.pullToRefreshView = nil; } }
Google translation。
Smaller devices (i.e. iPhones, especially 5s) in landscape barely give enough height to pull to refresh.
I changed the MinOffsetToPull constant to 50 to be suitable for all devices, but it might be preferable to have it dynamic.
What are your thoughts on this value?
hi
I'm on a server with a lot of data is an array. I want whenever I applied for twenty data show in table view can i use plugin ??
Great job, is there any way to add text under the loading bar?
👍
After refresh, UITableView's func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
isn't triggered by first tap.
Any idea how I can get the white line between the refresh view and my "Volume XX - Issue XX" label ?
DGElasticPullToRefreshLoadingViewCircle is not public and is not accessible when using DGE as a framework (CocoaPods).
Also, please consider renaming the classes to have shorter names. Swift has namespaces, so no need to obj-c style long names and prefixes.
When I add this to a tableview in loadView (or viewDidLoad) from a storyboard, the tableview disappears after pulling to refresh. The code is called in the action block, but the tableview no longer is shown. View Debugging doesn't show the tableview in the hierarchy.
Anyone else have this issue?
Version 7.1.1 (7B1005)
Hey, I try to use it whit the storyboard, but when I pull down the table view, the tableView goes away.
Probably, because I use a tableView in Storyboard with constraints..
I don't know if you know what i meen :)
I ported to Objective-C from your tutorial. Hope that Objective-C guys love it 😃
Very good animation need iOS 9.0 min, any plan to iOS 8.0 supported ?
Hello,
I really want to use this library but I just want to know will it be compatible with UICollectionView?
Thank you! ;)
I translate your swift source to objc.
https://github.com/mifanj/JElasticPullToRefresh
If ok I want to send it to bbs
you can contact me [email protected]
I'm waiting for Get the Green Light with you.
I'll not send it untill you answer me.
Set auto start loading:
func dg_startLoading()
Where is it?
Thanks for ur work.
For some reason, the view is snapping underneath my navigation bar? I have used the demo code given in the ReadMe.
// Initialize tableView
let loadingView = DGElasticPullToRefreshLoadingViewCircle()
loadingView.tintColor = UIColor(red: 78/255.0, green: 221/255.0, blue: 200/255.0, alpha: 1.0)
tableView.dg_addPullToRefreshWithActionHandler({ [weak self] () -> Void in
// Add your logic here
// Do not forget to call dg_stopLoading() at the end
self?.tableView.dg_stopLoading()
}, loadingView: loadingView)
tableView.dg_setPullToRefreshFillColor(UIColor(red: 57/255.0, green: 67/255.0, blue: 89/255.0, alpha: 1.0))
tableView.dg_setPullToRefreshBackgroundColor(tableView.backgroundColor!)
Video below..
Hi,
I use storyboard but pull to refresh feature doesnt work properly. Circle animation not working, it stop immediately, and table view invisable.
My code here:
` //myTableView = UITableView(frame: ucretsizMaclarTableView.frame, style: .Plain) // This line caused error. (FlexibleWidh & Flexible Height, nil error)
myTableView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
let loadingView = DGElasticPullToRefreshLoadingViewCircle()
loadingView.tintColor = UIColor(red: 78/255.0, green: 221/255.0, blue: 200/255.0, alpha: 1.0)
myTableView.dg_addPullToRefreshWithActionHandler({ [weak self] () -> Void in
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(10 * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), {
self?.myTableView.dg_stopLoading()
})
}, loadingView: loadingView)
myTableView.dg_setPullToRefreshFillColor(UIColor(red: 57/255.0, green: 67/255.0, blue: 89/255.0, alpha: 1.0))
myTableView.dg_setPullToRefreshBackgroundColor(ucretsizMaclarTableView.backgroundColor!)`
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.