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

Activity Indicator hides a little late #17

Closed
vinod93 opened this issue Aug 19, 2015 · 13 comments
Closed

Activity Indicator hides a little late #17

vinod93 opened this issue Aug 19, 2015 · 13 comments
Labels

Comments

@vinod93
Copy link

vinod93 commented Aug 19, 2015

After fetching the data from server, when the new collection view items are inserted then the activity indicator hides late for 1 sec.
What i want to do is to hide the activity indicator before the items are inserted, so inorder to resolve this what has to be done.

Thank you.

@pronebird
Copy link
Owner

Hello! That does not sound right. Do you call finishInfiniteScroll from the main thread? Also I suggest you take a look at demo app which uses collection view and everything seems to work fine.

@vinod93
Copy link
Author

vinod93 commented Aug 19, 2015

Yes I did called it on main thread just like in the demo. The problem that I'm having is the activity indicator stops animating almost 1sec later i.e., after the new items are inserted and on the call of the finish() block the finishInfiniteScroll method gets called & it take a delay.

...
[self.collectionView insertItemsAtIndexPaths:arrayWithIndexPath];
}
 completion:^(BOOL finished) {
                        finish();
                    }]; 

So my concern here is how to solve this delaying issue.

@pronebird
Copy link
Owner

Could you please prepare a sample project reproducing this issue? I looked at the demo today and I didn't notice any delay.

@pronebird pronebird added support and removed support labels Aug 20, 2015
@pronebird
Copy link
Owner

Oh yeah, I think I see what you mean. It's in fact disappears with a short delay.

@vinod93
Copy link
Author

vinod93 commented Aug 20, 2015

https://drive.google.com/file/d/0B3Q2nuVLZgySY3lOZlp0bDZMN0U/view?usp=sharing

You can have a look at the video demo. Also i'll tell you what I have changed from the demo code.

instead of

    // Create custom indicator
CustomInfiniteIndicator *indicator = [[CustomInfiniteIndicator alloc] initWithFrame:CGRectMake(0, 0, 24, 24)]; 

I have created the default indicator

UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];

and finally assigned it to this

// Set custom indicator
    self.collectionView.infiniteScrollIndicatorView = indicator;

@vinod93
Copy link
Author

vinod93 commented Aug 20, 2015

Yes so what can be done to correct that. Please.

@pronebird
Copy link
Owner

Thanks for all your suggestions and video that you recorded and sorry for a late reply.

I know it does not look as good as it could be but I think there is not much to be done here. Apparently collection view delays the completion handler I assume to finish pending animations, that's why finishInfiniteScroll kicks in too late. I don't see how this issue can be solved with the public APIs that Apple provides us.

@doseAt
Copy link

doseAt commented Dec 1, 2016

Hello pronebird. In the example project the animation of loading last about 5-6 seconds. The content in example project is very light, it should be pulled from server for max second or two, why it last so long?

@pronebird
Copy link
Owner

pronebird commented Dec 1, 2016

@doseAt I don't think this issue is about that. In example project artificial delay introduced for demo purposes, exactly because the content is very light and loads very fast.

@doseAt
Copy link

doseAt commented Dec 1, 2016

@pronebird well i have a problem like that in my own project, loading bar keeps loading even after the pull from server is done and tableView.finishInfiniteScroll() is called. What can i try, and where can i find more docs about plugin?

@pronebird
Copy link
Owner

pronebird commented Dec 1, 2016

@doseAt would you mind creating a separate issue and trying to create a minimal project to reproduce your issue? Most of the time problems like that arise because finishInfiniteScroll() is called on background thread.

@pronebird
Copy link
Owner

pronebird commented Dec 1, 2016

@doseAt documentation is generated from source code and available at http://cocoadocs.org/docsets/UIScrollView-InfiniteScroll/0.9.1/

@pronebird
Copy link
Owner

Closing because there is not much can be done, UICollectionView calls completionHandler a little late. You may want to file a radar with Apple.

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

No branches or pull requests

3 participants