gontovnik / DGElasticPullToRefresh

Elastic pull to refresh for iOS developed in Swift
https://medium.com/@gontovnik/elastic-view-animation-or-how-i-built-dgelasticpulltorefresh-269a3ba8636e#.9dioekqv6
MIT License
3.77k stars 443 forks source link

How to Fire the Pull to Refresh? #7

Open ortizroberto opened 8 years ago

ortizroberto commented 8 years ago

It would be nice to have a method to fire the pull to refresh, something like objc dg_startLoading

gontovnik commented 8 years ago

Hey. With a bounce effect?

ortizroberto commented 8 years ago

With bounce effect would be a big plus, but to fire without the bounce animation it's fine. Thanks for this project btw.

BalestraPatrick commented 8 years ago

I started working on this and I'm able to start the animation by changing the content offset of the scrollView.

func startAnimating() {
    scrollView()?.setContentOffset(CGPoint(x: 0, y: -DGElasticPullToRefreshConstants.MinOffsetToPull), animated: true)
}

The problem is that the UIScrollView doesn't bounce back and fires the actionHandler. Which property are you observing to detect when to refresh? I read the code for the last 2 hours but I couldn't find anything useful.

thiagorossener commented 8 years ago

+1

lorenzhk commented 8 years ago

There is "func dg_startLoading()" mentioned in the README, but it isn't there. Would anyone help about it? Thank you so much!

drakon commented 8 years ago

Hi there,

any news about this?

There is actually a fix out there that works (see: https://github.com/Sunreaver/DGElasticPullToRefresh). Is it possible to pull this into the official repo?

Btw: Awesome refresher!

sanderus2311 commented 8 years ago

+1 Is it possible? Any working solution? This one by drakon doesn't work for me.

joe528 commented 8 years ago

@sanderus2311 The one from drakon works for me, what do you see?