Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh action is call twice without calling tableView.startPullToRefresh() #12

Open
pablomiguelfernandez opened this issue Apr 26, 2015 · 6 comments

Comments

@pablomiguelfernandez
Copy link

Hi! I have adde the Refresher framework to my project, great work! But I am facing a problem.

I've just added a tableView to a ViewController and create the Outlet, delegate and datasource and on viewDidLoad I have added:

tableView.addPullToRefreshWithAction {
NSOperationQueue().addOperationWithBlock {
sleep(2)
NSOperationQueue.mainQueue().addOperationWithBlock {
self.tableView.stopPullToRefresh()
}
}
}

The problem is that automatically when the view is load, the refresh action is done twice!

I am not calling tableView.startPullToRefresh() at any point of my code, if I had the tableView.startPullToRefresh() on viewDidAppear as in the demo project the refresh action will be ejecute three times!

Any idea of what the problem could be?

Thanks very much for your help

@jcavar
Copy link
Owner

jcavar commented Apr 26, 2015

Hi, I don't know why that might happen. Can you send me your project, or create demo one with issue so I can check?

@pablomiguelfernandez
Copy link
Author

Thanks for your answer! He I have prepared you a demo project.
You will be able to see that when the view is load, the refresh action is executed twice, but I did not call startPullToRefresh.

Here is de project
https://www.dropbox.com/s/ppdhsp8rxer0u7v/demo.zip?dl=1

Thanks for your help!

@jcavar
Copy link
Owner

jcavar commented Apr 26, 2015

It looks like there is a problem with translucent navigation bar. If your project doesn't require it you can turn it off and it should work then. I will need more time to look into this.

Thanks for reporting

@pablomiguelfernandez
Copy link
Author

Yes! that's the problem! the translucent navigation bar...
Thanks for your help

@jcavar
Copy link
Owner

jcavar commented Apr 26, 2015

It turned out that problem isnt translucent navigation bar but automaticallyAdjustsScrollViewInsets property which is by default set to true. You can do
self.automaticallyAdjustsScrollViewInsets = false before adding refresher and everything should be fine. I have spent some time today trying to figure out solution to this but without success. There is similar issue here:
samvermette/SVPullToRefresh#145

@shirejiang
Copy link

Maybe in the demo project you should put those code on ViewDidAppear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants