I'm trying to implement a UIRefreshControl
in my project on a UICollectionView
. It works as intended, but I need to pull the the UICollectionView
about 3x as much as the height of the refreshControl
when it's spinning (once the user has let go). I've seen other apps where you only need to pull down to the height of the refreshControl
when it's spinning. How do I change the amount I need to pull down?
Code:
(void)viewDidLoad {
[super viewDidLoad];
[self.collectionView setBackgroundColor:[UIColor clearColor]];
self.refreshControl = [UIRefreshControl new];
[self.refreshControl addTarget:self action:@selector(refreshFavorites) forControlEvents:UIControlEventValueChanged];
[self.collectionView addSubview:self.refreshControl];
self.collectionView.alwaysBounceVertical = YES;
}
Attached are pictures to help visualize what I mean. My collectionView
has one row (solid red). The space between the red and the refreshControl
is simply the space I'm pulling down to try to activate the refreshControl
.
In this image I've almost activated the control and I've already pulled down a considerable amount on the screen.
In this image I've activated the control and it's starting to load (after it jumps ~20-30 pix, but it still highlights how significant this is)
This image shows the control in its "resting" state after it's been activated and is doing the animation.
I've tried setting the frame of the UIRefreshControl
to try to control the height, but this doesn't work. I've also changed around the size in collectionView:layout:sizeForItemAtIndexPath
which hasn't helped.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…