集合视图流布局是否具有分页概念?

时间:2018-04-13 11:36:28

标签: ios swift swift3

我整合了集合视图流程布局水平和垂直两者但现在我想在它上面执行分页概念。我想知道我能动态地这样做吗?

2 个答案:

答案 0 :(得分:1)

检查isPagingEnabled = true您的收藏视图。

代码样式注意:确保正确地改变您的变量。

答案 1 :(得分:0)

1.在项目中安装pod文件。

  

pod'CCBottomRefreshControl'

  1. 将此文件导入VC中要使用分页的文件。
  2.   

    CCBottomRefreshControl / UIScrollView的+ BottomRefreshControl.h

    1. 使用以下代码添加分页。

      -(void)bottomRefreshEnable{
      
          UIRefreshControl *refreshControl;
          refreshControl = [UIRefreshControl new];
          refreshControl.triggerVerticalOffset = 70;
          [refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];
      
          self.customScrollView.bottomRefreshControl = refreshControl;
      
      }
      
    2. 在检测到滚动偏移时将调用的最后一个方法(我们在上面的代码中保留了70)。

      - (void)handleRefresh:(UIRefreshControl *)refreshControl {
      
      
      }