UIRefreshControl on UICollectionView only works if the collection fills the height of the container

前端 未结 7 1298
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 05:35

I\'m trying to add a UIRefreshControl to a UICollectionView, but the problem is that the refresh control does not appear unless the collection view

7条回答
  •  眼角桃花
    2020-12-02 06:02

    Try this:

    self.collectionView.alwaysBounceVertical = YES;

    Complete code for a UIRefreshControl

    UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
    refreshControl.tintColor = [UIColor grayColor];
    [refreshControl addTarget:self action:@selector(refershControlAction) forControlEvents:UIControlEventValueChanged];
    [self.collectionView addSubview:refreshControl];
    self.collectionView.alwaysBounceVertical = YES;
    

提交回复
热议问题