我尝试在 Collection View 中下拉刷新,但我对 Collection View 使用( TableView 下拉刷新 Controller )相同的代码。请任何人帮助我解决问题。
最佳答案
首先,您可以在 viewDidLoad 中编写此代码:-
- (void) viewDidLoad
{
[super viewDidLoad];
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
refreshControl.tintColor = [UIColor blackColor];
refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull to Refresh"];
[refreshControl addTarget:self action:@selector(refreshControlAction) forControlEvents:UIControlEventValueChanged];
[collectionView addSubview:refreshControl];
}
Now add a target
- (void) refreshControlAction
{
// Enter your code for request you are creating here when you pull the collectionView. When the request is completed then the collectionView go to its original position.
}
关于ios - 是否可以下拉刷新并在 uicollectionview 的自定义集合单元格中加载更多内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19873206/