ios collectionview怎样刷新单行ui

2024-11-16 03:32:48
推荐回答(1个)
回答1:

UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
flowLayout.minimumInteritemSpacing = 0;
flowLayout.minimumLineSpacing = 0;

self.collectionView.collectionViewLayout = flowLayout;
self.collectionView.delegate = self;
self.collectionView.dataSource = self;

self.collectionView.backgroundColor = [UIColor whiteColor];

self.refreshControl = [[UIRefreshControl alloc] init];
[self.refreshControl addTarget:self action:@selector(controlEventValueChanged) forControlEvents:UIControlEventValueChanged];

[self.collectionView addSubview:self.refreshControl];