In my application I use refresh control with collection view.
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:[UIScreen mainScreen].bounds];
collectionView.alwaysBounceVertical = YES;
...
[self.view addSubview:collectionView];
UIRefreshControl *refreshControl = [UIRefreshControl new];
[collectionView addSubview:refreshControl];
iOS7 has some nasty bug that when you pull collection view down and don't release your finger when refreshing begins, vertical contentOffset
shifts for 20-30 points down which results in ugly scroll jump.
Tables have this problem too if you use them with refresh control outside of UITableViewController
. But for them it could be easily solved by assigning your UIRefreshControl
instance to UITableView
's private property called _refreshControl
:
@interface UITableView ()
- (void)_setRefreshControl:(UIRefreshControl *)refreshControl;
@end
...
UITableView *tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds];
[self.view addSubview:tableView];
UIRefreshControl *refreshControl = [UIRefreshControl new];
[tableView addSubview:refreshControl];
[tableView _setRefreshControl:refreshControl];
But UICollectionView
does not have such property so there must be some way to deal with it manually.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…