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

DGElasticPullToRefresh sometimes stays on screen until scroll #28

Open lkuczborski opened 8 years ago

lkuczborski commented 8 years ago

Steps to reproduce:

  1. Fire pull to refresh
  2. Quickly go to some detail view controller
  3. Quickly go back

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?

lkuczborski commented 8 years ago

@gontovnik will you have some time to look at it?

lkuczborski commented 8 years ago

@gontovnik any chance to look at it?

mickychen0524 commented 7 years ago

+1

ghost commented 7 years ago

any solution?

JerryThl commented 5 years ago

Temporally Solution

Scroll to last item and scroll back to top again solved this problem

In your dg_addPullToRefreshWithActionHandler

        let lastItemIndex = NSIndexPath(item: YOUR_DATA.count - 1, section: 0)
        let firstItemIndex = NSIndexPath(item: 1, section: 0)

        self?.collectionview?.scrollToItem(at: lastItemIndex as IndexPath, at: .bottom, animated: true)

        DispatchQueue.main.asyncAfter(deadline: .now() + 0.5)
        {
            self?.collectionview_transaction?.scrollToItem(at: firstItemIndex as IndexPath, at: .bottom, animated: true)
        }