SVPullToRefresh cannot pull on an empty UICollectionView
Asked Answered
W

1

2

I got an empty UICollectionView, which means the cell count is 0 in it.

I intended to do so, so when no usable data, numberOfItemsInSection will return 0. Then user can choose to Pull to refresh if no data available. (content size is smaller than screen height, excluding the PullToRefresh arrow views)

My problem is if there is at least one cell, pull to refresh works perfect,

but when no cell, I cannot pull to refresh. I am not sure how to do it, or if the cell count impact the pullToRefresh?

My code is quite simple:

[collectionView addPullToRefreshWithActionHandler:^{
    [weakSelf reloadDashboardData];
}];
collectionView.alwaysBounceVertical = YES;
collectionView.bounces = YES;
[collectionView addSubview:_emptyIndicator];
Wrapping answered 9/3, 2015 at 11:0 Comment(0)
W
1

Similar to Enable bounce/scroll for UICollectionView while no cells

The old code forgot to turn on UserInteraction in a failure call back.

Code in question above is definitely fine.

Wrapping answered 10/3, 2015 at 9:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.