SVPullToRefresh cannot pull an empty UICollectionView

I got an empty UICollectionView, which means the number of cells in it is 0.

I intended to do this, so when there is no data available, numberOfItemsInSection will return 0. Then the user can select Pull to refresh if there is no data. (content size is less than the height of the screen, excluding the types of arrows PullToRefresh)

My problem is that there is at least one cell, pull to refresh work perfectly,

but when there are no cells, I can not pull to refresh. I'm not sure how to do this, or if the number of cells affects pullToRefresh?

My code is pretty simple:

 [collectionView addPullToRefreshWithActionHandler:^{ [weakSelf reloadDashboardData]; }]; collectionView.alwaysBounceVertical = YES; collectionView.bounces = YES; [collectionView addSubview:_emptyIndicator]; 
+2
source share
1 answer

Looks like Turn on scan / scroll for UICollectionView until no cells

The old code forgot to enable UserInteraction in the callback.

The code in question above is definitely fine.

+1
source

Source: https://habr.com/ru/post/983568/


All Articles