ios - 是否可以下拉刷新并在 uicollectionview 的自定义集合单元格中加载更多内容?

标签 ios

我尝试在 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/

相关文章:

ios - codeigniter - 连接失败 : 0 while sending ios notifications

ios - 可变参数 v 数组参数

iphone - NSDateCompononents 中可能存在错误吗?

ios - 获取当前页面

ios - Swift 3 多线程使用哪个队列?

ios - 从 Swift 4 新的键路径语法获取字符串?

ios - 刷卡不起作用。如何解决这个问题?

ios - UICollectionView ios 7 问题

ios - 没有电话号码时应用程序崩溃

ios - 如何在 iPad 的 UiSplitviewcontroller 中显示主视图